alamb commented on code in PR #26640:
URL: https://github.com/apache/datafusion/pull/26640#discussion_r4417526454


##########
datafusion/optimizer/src/decorrelate.rs:
##########
@@ -897,6 +923,37 @@ impl PullUpCorrelatedExpr {
     }
 }
 
+/// Whether the emptiness of `plan`'s output follows from the emptiness of its

Review Comment:
   I don't really understand what emptness means in this context. Is this 
saying if the input to the plan is non empty than the output will also be non 
empty?
   
   How will we know that for user defined plans?



##########
datafusion/optimizer/src/decorrelate.rs:
##########
@@ -897,6 +923,37 @@ impl PullUpCorrelatedExpr {
     }
 }
 
+/// Whether the emptiness of `plan`'s output follows from the emptiness of its
+/// input alone, so that `plan` cannot tell apart two non-empty inputs. 
Removing
+/// a `Limit` below such a node changes which rows it is given, never whether 
it
+/// is given any, and so never whether the subquery is empty.
+///
+/// A `Projection`, a `SubqueryAlias`, a `Sort`, a `Window` and a `Repartition`
+/// each output one row per input row. A `DISTINCT` and a grouped `Aggregate` 
output rows
+/// exactly when their input has rows, and an `Aggregate` without a grouping
+/// always outputs its one row, so no `Aggregate` can be emptied by the rows a
+/// `Limit` held back.
+/// A materialized CTE outputs exactly its continuation's rows, and only the
+/// continuation is rewritten, so its emptiness follows that input.
+///
+/// A `Filter` is what this leaves out: it reads values, so the rows the 
`Limit`

Review Comment:
   I found this really hard to understand -- it seems to be saying that Filter 
removes rows ?



##########
datafusion/optimizer/src/decorrelate_predicate_subquery.rs:
##########
@@ -2820,6 +2820,137 @@ mod tests {
         )
     }
 
+    /// A `Limit` whose row count nothing above it can observe is still 
dropped,

Review Comment:
   what value do these tests add over just SLT tests?



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