DanSkells commented on issue #54646:
URL: https://github.com/apache/spark/issues/54646#issuecomment-4010363825

   So we do something like:
   
   ```
   import org.apache.spark.sql.SparkSession
   import org.apache.spark.sql.functions._
   
   val spark = SparkSession.builder().appName("testApp").getOrCreate()
   
   import spark.implicits._
   
   val map = spark.read.parquet("somePath") // Some path with 1 million + 
records
      .select($"key", $"value").as[(String, String)].collect().toMap()
   
   val mapCol = typedLit(map)
   
   val dataframe = spark.read.parquet("otherPath").select(element_at($"key", 
mapCol))
   
   ```
   This then does a linear scan through the map. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to