Copilot commented on code in PR #24063:
URL: https://github.com/apache/datafusion/pull/24063#discussion_r3705084739


##########
datafusion/physical-expr/src/equivalence/properties/mod.rs:
##########
@@ -1165,8 +1165,27 @@ impl EquivalenceProperties {
         self.constraints.project(&indices)
     }
 
-    /// Projects the equivalences within according to `mapping` and
-    /// `output_schema`.
+    /// Projects these equivalence properties onto `output_schema` according to
+    /// `mapping`, returning the properties that still hold for the projected
+    /// output.
+    ///
+    /// `mapping` maps each source expression (evaluated against the current
+    /// schema) to the output column(s) it produces. This is more than a
+    /// column-index remap: the orderings, the equivalence group and the
+    /// constraints are all carried through `mapping`, keeping only what the
+    /// projected schema can still express.
+    ///
+    /// - Orderings: an existing ordering is carried to a target only when the
+    ///   mapping expression is order-preserving for it, as determined from the
+    ///   expression's [`SortProperties`]. For example, an ordering on `c` is
+    ///   preserved through `c + 1` but dropped through `abs(c)`. Orderings
+    ///   implied by the mapping are also derived, e.g. an ordering on `a + b`
+    ///   yields one on the projected `a_new + b_new`.

Review Comment:
   The example “an ordering on `a + b` yields one on the projected `a_new + 
b_new`” is ambiguous because `a + b` is not an ordering *on a column* but an 
ordering on an expression, and it’s unclear whether the intent is (1) the input 
already had an ordering on the expression `a + b`, or (2) an ordering on `(a, 
b)` implies ordering on `a + b` (which is not generally true). Consider 
rephrasing to explicitly say “an ordering on the expression `a + b` …” and, if 
helpful, clarify that this only applies when that expression exists in the 
input properties and remains expressible after projection.



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