You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/09 02:47:42 UTC

[GitHub] [spark] gatorsmile commented on issue #26978: [SPARK-29721][SQL] Prune unnecessary nested fields from Generate without Project

gatorsmile commented on issue #26978: [SPARK-29721][SQL] Prune unnecessary nested fields from Generate without Project
URL: https://github.com/apache/spark/pull/26978#issuecomment-583798709
 
 
   ```
       withTable("persisted") {
         val jsonStr = """{
            "items": [
              {"itemId": 1, "itemData": "a"},
              {"itemId": 2, "itemData": "b"}
            ]
           }"""
         val df = spark.read.json(Seq(jsonStr).toDS)
         df.write.format("parquet").mode("overwrite").saveAsTable("persisted")
   
         val read = spark.table("persisted")
         spark.conf.set("spark.sql.optimizer.nestedSchemaPruning.enabled", true)
         read.select(explode_outer($"items.itemId"), $"items.itemData").explain(true)
       }
   ```
   
   Try the above example. @dongjoon-hyun @viirya 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org