I am trying to read a 30K rows data from cosmos db using the spark cosmos connector using the following code
val readConfig = Config(Map(
"Endpoint" -> "",
"Masterkey" -> "",
"Database" -> "",
"Collection" -> "",
"PreferredRegions" -> "",
"query_custom" -> """SELECT t.id,t.gender,t.loc from Tab t"""
))
val df = spark.read.cosmosDB(readConfig)
In the 30k, only 2 rows have non null values for 'loc' column. But for some reason the connector is dropping the 'loc' column altogether in the final dataframe and the final dataframe is giving the following schema
df.printSchema
root
|-- id: string (nullable = true)
|-- gender: string (nullable = true)
Can someone please help me how to get the 'loc' column included in my final dataframe.