mgaido91 commented on issue #24223: [SPARK-27278][SQL] Optimize GetMapValue 
when the map is a foldable and the key is not
URL: https://github.com/apache/spark/pull/24223#issuecomment-479458601
 
 
   I have run:
   ```
   val dfPlan = spark.range(10).selectExpr(
        "map(1, 1, 2, id, 3, id * 2, 4, 1, 5, 2, 6, 3, 7, 4)[id] as 
x").queryExecution.executedPlan
   val times = (1 to 20).map(_ => time(dfPlan.executeCollect()))
   println("Avg time: " + (times.sum / times.size) / 1e6 + " ms")
   ```
   Before the change I got `Avg time: 20.001603 ms`, after I got `Avg time: 
18.727406 ms`, hence roughly a 10% improvement from this test.
   
   Despite this, I quite agree with the concern related to the generated code 
size, which in general is not a big deal but it may cause regression if this 
makes WholeStageCodegen fallback to normal code generation. The other case is 
safer w.r.t this topic, as it removes the `CreateMap` which would be quite 
verbose as well.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to