xuzifu666 opened a new pull request, #55982:
URL: https://github.com/apache/spark/pull/55982

   jira: https://issues.apache.org/jira/browse/SPARK-56940
   
   The Apache Spark SQL optimizer rule OptimizeRand only handled simple 
comparisons with the rand() function, such as rand() > 0.5 or rand() < 1. It 
did not optimize more complex expressions that
   
     combine rand() with arithmetic operations, such as:
   ```
     - rand() * 3 < 3 (scalar multiplication)
   
     - rand() + 1 < 2 (addition)
   
     - rand() - 1 < -1 (subtraction)
   
     - rand() / 2 < 1 (division)
   
     - Nested expressions: 2 * rand() + 1 < 3
   ```
     
   
   These queries can still be statically evaluated because rand() always 
produces values in the range [0, 1), making the outcome of many such 
comparisons deterministic at compile time.


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