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



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

Reply via email to