raviston commented on PR #60325:
URL: https://github.com/apache/spark/pull/60325#issuecomment-6804156856

   Thank you for the thorough review, @sarutak, and for checking it against 
#60296. I pushed e2a1491b77a, which addresses all of it:
   
   1. The title and the description now say "correlated subquery", and the 
table includes your `LATERAL`, `EXISTS` and `IN` queries (on `o`, where every 
outer row has matching rows; all three fail with `DIVIDE_BY_ZERO` on master). 
The test covers them, and the `LATERAL` and `IN` ones over `o2` fail with 
`DIVIDE_BY_ZERO` at runtime.
   2. The description now says that when the result on zero rows is used for an 
outer row without matching rows, the query fails with the same error at 
runtime, or while the query is optimized if the subquery is known to be empty. 
With the change in the inline comment, I checked that your `(SELECT * FROM i 
WHERE false)` query still fails while it is optimized. It also says that a 
grouped scalar subquery and `EXISTS` don't use the result on zero rows, and the 
test now has your two `o2` queries: `(1, 0.05), (2, 0.0333...), (3, NULL)` and 
`(1), (2), (3)`. The first section and the comment in `tryEvalExpr` no longer 
say "at runtime".
   3. It now says "Queries that did not fail before are unchanged." Your 
`element_at` query is in the test with ANSI off: on `o` it returns `(1, 2), (2, 
1)` (`INVALID_INDEX_OF_ZERO` on master), and on `o2` it fails with 
`INVALID_INDEX_OF_ZERO` at runtime.
   4. The Scaladoc of `bindingExpr`, `evalAggExprOnZeroTups`, 
`evalAggregateOnZeroTups` (and the comment in it) and `evalSubqueryOnZeroTups`, 
and the comment and the `assert` message in `DecorrelateInnerQuery`, now say 
that a result that can't be evaluated statically is kept as an expression.
   
   I'll also update the JIRA title to say "correlated subquery".
   


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