Skip to content

Commit 49cd779

Browse files
authored
docs(optimizer): Fix PushDownFilter doc typos. (#22320)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - N/A, simple doc typos I discovered. These changes should make the `PushDownFilter` optimizer rule documentation a little clearer. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. -->
1 parent c8b784a commit 49cd779

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

datafusion/optimizer/src/push_down_filter.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use datafusion_expr::ExpressionPlacement;
6666
/// Sort (a, b)
6767
/// ```
6868
///
69-
/// A better plan is to filter the data *before* the Sort, which sorts fewer
69+
/// A better plan is to filter the data *before* the Sort, which sorts fewer
7070
/// rows and therefore does less work overall:
7171
///
7272
/// ```text
@@ -80,7 +80,7 @@ use datafusion_expr::ExpressionPlacement;
8080
/// different result.
8181
///
8282
/// ```text
83-
/// Filter (a > 10) <-- can not move this Filter before the limit
83+
/// Filter (a > 10) <-- cannot move this Filter before the limit
8484
/// Limit (fetch=3)
8585
/// Sort (a, b)
8686
/// ```
@@ -90,46 +90,46 @@ use datafusion_expr::ExpressionPlacement;
9090
/// satisfies `filter(op(data)) = op(filter(data))`.
9191
///
9292
/// The filter-commutative property is plan and column-specific. A filter on `a`
93-
/// can be pushed through a `Aggregate(group_by = [a], agg=[sum(b))`. However, a
94-
/// filter on `sum(b)` can not be pushed through the same aggregate.
93+
/// can be pushed through a `Aggregate(group_by = [a], agg=[sum(b)])`. However, a
94+
/// filter on `sum(b)` cannot be pushed through the same aggregate.
9595
///
9696
/// # Handling Conjunctions
9797
///
98-
/// It is possible to only push down **part** of a filter expression if is
98+
/// It is possible to only push down **part** of a filter expression if it is
9999
/// connected with `AND`s (more formally if it is a "conjunction").
100100
///
101101
/// For example, given the following plan:
102102
///
103103
/// ```text
104104
/// Filter(a > 10 AND sum(b) < 5)
105-
/// Aggregate(group_by = [a], agg = [sum(b))
105+
/// Aggregate(group_by = [a], agg = [sum(b)])
106106
/// ```
107107
///
108-
/// The `a > 10` is commutative with the `Aggregate` but `sum(b) < 5` is not.
109-
/// Therefore it is possible to only push part of the expression, resulting in:
108+
/// The `a > 10` is commutative with the `Aggregate` but `sum(b) < 5` is not.
109+
/// Therefore it is possible to only push down part of the expression, resulting in:
110110
///
111111
/// ```text
112112
/// Filter(sum(b) < 5)
113-
/// Aggregate(group_by = [a], agg = [sum(b))
113+
/// Aggregate(group_by = [a], agg = [sum(b)])
114114
/// Filter(a > 10)
115115
/// ```
116116
///
117117
/// # Handling Column Aliases
118118
///
119-
/// This optimizer must sometimes handle re-writing filter expressions when they
120-
/// pushed, for example if there is a projection that aliases `a+1` to `"b"`:
119+
/// This optimizer must sometimes handle rewriting filter expressions when they are
120+
/// pushed. For example, consider a projection that aliases `a+1` to `"b"`:
121121
///
122122
/// ```text
123123
/// Filter (b > 10)
124124
/// Projection: [a+1 AS "b"] <-- changes the name of `a+1` to `b`
125125
/// ```
126126
///
127-
/// To apply the filter prior to the `Projection`, all references to `b` must be
127+
/// To push this filter below the `Projection`, all references to `b` must be
128128
/// rewritten to `a+1`:
129129
///
130130
/// ```text
131-
/// Projection: a AS "b"
132-
/// Filter: (a + 1 > 10) <--- changed from b to a + 1
131+
/// Projection: [a+1 AS "b"]
132+
/// Filter: (a+1 > 10) <--- changed from b to a+1
133133
/// ```
134134
/// # Implementation Notes
135135
///

0 commit comments

Comments
 (0)