我正在尝试通过以下方式从数据源使用scala来从cosmos db读取流:https://docs.microsoft.com/bs-latn-ba/azure/cosmos-db/spark-connector 但是以某种方式,scala读取流代码的示例对我不起作用。
我一直在尝试导入更多的库,例如“ com.microsoft.azure.cosmosdb.spark.streaming._”,但是仍然无法正常工作。
这是我要使用的scala代码
import com.microsoft.azure.cosmosdb.spark.schema._
import com.microsoft.azure.cosmosdb.spark._
import com.microsoft.azure.cosmosdb.spark.config.Config
val readConfig = Config(Map(
"Endpoint" -> cosmos_endpoint,"Masterkey" -> cosmos_masterkey,"Database" -> "abc","Collection" -> "123","ReadChangeFeed" -> "true","ChangeFeedQueryName" -> "Scala-Changefeed","ChangeFeedStartFromTheBeginning" -> "true","InferStreamSchema" -> "false","ChangeFeedCheckpointLocation" -> ".../ChagefeedCheckpoint"))
val changeFeed = spark.readStream.format(classOf[CosmosDBSourceProvider].getName).options(readConfig).load()
我收到的错误消息是
command-2054522864350223:16: error: not found: type CosmosDBSourceProvider
val changeFeed = spark.readStream.format(classOf[CosmosDBSourceProvider].getName).options(readConfig).load()
^