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/11/06 05:10:48 UTC

[GitHub] [spark] cloud-fan commented on pull request #21852: [SPARK-24893] [SQL] Remove the entire CaseWhen if all the outputs are semantic equivalence

cloud-fan commented on pull request #21852:
URL: https://github.com/apache/spark/pull/21852#issuecomment-722823667


   @wangyum this looks correct. After `SELECT *, rand(100) as rd FROM t`, the output column `rd` is deterministic, as the result of `rand(100)` is materialized. We can treat it like writing `SELECT *, rand(100) as rd FROM t` to a table and read back.
   
   However, I do see a problem:
   ```
   scala> sql("select 1 FROM (SELECT *, rand(100) as rd FROM t) t1").explain
   == Physical Plan ==
   *(1) Project [1 AS 1#4]
   +- FileScan json default.t[] Batched: false, DataFilters: [], Format: JSON, Location: InMemoryFileIndex[file:/Users/cloud0fan/dev/spark/assembly/spark-warehouse/t], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<>
   ```
   
   Seems we shouldn't eliminate the project with `rand(100)`. But it's not related to this PR.


----------------------------------------------------------------
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



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