Skip to content

Commit 6893e0d

Browse files
adriangbclaude
authored andcommitted
fix: decide the precedence between PushDownFilter and PushDownLeafProjections (apache#25455)
## Which issue does this PR close? - Closes apache#14540. ## Rationale for this change `PushDownFilter` and `PushDownLeafProjections` both move nodes towards the leaves. For an adjacent filter and *pure extraction projection* they want the opposite order. A pure extraction projection is the node `ExtractLeafExpressions` creates: its expressions are only `__datafusion_extracted_N` aliases and pass-through columns. ```text Filter: t1.date = Date32("2025-01-03") <-- (A) Projection: get_field(t1.ids, "id1") AS __datafusion_extracted_1, t1.date <-- (B) TableScan: t1 ``` `push_down_filter` puts (A) below (B). `push_down_leaf_projections` puts (B) below (A). On `main` both rules report a change in every optimizer pass, and the rule that runs later in the rule list decides the plan. Nobody had picked a side. The last comment on the issue asks which rule must yield. ### Experiment Three variants were measured with `datafusion-cli`, on the query from the issue and on the simpler `SELECT ids['id1'] FROM t1 WHERE date = '2025-01-03'`, against a memory table and a Parquet file, with `datafusion.execution.parquet.pushdown_filters` set to `false` (the default) and to `true`: - **(a) main**: the extraction projection ends below the filter, because `push_down_leaf_projections` runs last. - **(b) leaf rule yields**: `PushDownLeafProjections` does not move a pure extraction projection through a filter whose predicate does not reference the extracted aliases. The filter ends below the extraction projection. - **(c) filter rule yields**: `PushDownFilter` treats a pure extraction projection as non-pushable. The filter stays above it, and the leaf rule has nothing to undo. Two properties must both survive: the struct leaf must reach `DataSourceExec` (`projection=[get_field(...) ...]`), and the `date` predicate must reach `DataSourceExec` (`predicate=` plus `pruning_predicate=`). | variant | query | source | `pushdown_filters` | leaf in scan | filter in scan | passes | | --- | --- | --- | --- | --- | --- | --- | | (a) main | simple | Parquet | false | yes | yes | 2 | | (a) main | simple | Parquet | true | yes | yes | 2 | | (a) main | simple | memory | n/a | n/a | n/a | 2 | | (a) main | apache#14540 | Parquet | false | yes | yes | 3 | | (a) main | apache#14540 | Parquet | true | yes | yes | 3 | | (a) main | apache#14540 | memory | n/a | n/a | n/a | 3 | | (b) leaf yields | simple | Parquet | false | **no** (`projection=[date, ids]`) | yes | 2 | | (b) leaf yields | simple | Parquet | true | yes | yes | 2 | | (b) leaf yields | simple | memory | n/a | n/a | n/a | 2 | | (b) leaf yields | apache#14540 | Parquet | false | **no** (`projection=[date, timestamp, ids, structs]`) | yes | 2 | | (b) leaf yields | apache#14540 | Parquet | true | yes | yes | 2 | | (b) leaf yields | apache#14540 | memory | n/a | n/a | n/a | 2 | | (c) filter yields | simple | Parquet | false | yes | yes | 2 | | (c) filter yields | simple | Parquet | true | yes | yes | 2 | | (c) filter yields | simple | memory | n/a | n/a | n/a | 2 | | (c) filter yields | apache#14540 | Parquet | false | yes | yes | 3 | | (c) filter yields | apache#14540 | Parquet | true | yes | yes | 3 | | (c) filter yields | apache#14540 | memory | n/a | n/a | n/a | 3 | "passes" counts the invocations of `push_down_filter`, that is the number of optimizer passes the plan needs. ### Decision **`PushDownFilter` yields. Pure extraction projections win.** Variant (c). Variant (b) fails the goal. At the default `pushdown_filters = false` the `get_field` no longer reaches `DataSourceExec`, so the scan reads the whole struct. The physical `ProjectionPushdown` rule cannot recover it. `FilterExec::try_swapping_with_projection` rewrites the predicate against the projection output, and the predicate needs the `date` column, which the projection does not produce. The `ProjectionExec` therefore stays above the `FilterExec` and never reaches the scan. Only `pushdown_filters = true` recovers it, and that is not the default. Variants (a) and (c) keep both properties everywhere, so the tie breaks on the remaining differences. Variant (c) wins on three of them: 1. The plan is simpler. Under (a) the apache#14540 query keeps two `Filter` nodes and an extra pass-through `Projection` between them. Under (c) the two filters merge into one node and the pass-through projection is gone. 2. The plan is a verified fixed point. Under (a) the last optimizer pass still changes the plan, so the plan that survives is the one the last rule left, not a stable one. Under (c) the last pass changes nothing. 3. The cheap conjunct runs first. Under (c) the merged filter evaluates `date = '2025-01-03'` before the four `get_field` comparisons. The filter loses nothing by staying one node higher. `PushDownFilter` runs before `ExtractLeafExpressions` in the rule list, so it records the predicate in `TableScan::filters` in the first pass, before any extraction projection exists. Row group pruning and source level filtering are unaffected, which the Parquet rows of the table show. On a source that cannot absorb the projection, such as a memory table, (c) keeps the filter above the extraction projection, so `get_field` runs before the filter. That is the order `main` produces today (variant (a)), so it is not a regression, but it is not the better order for that source. Only variant (b) runs the filter first there, and (b) is rejected for the Parquet reason above. Residual risk: a filter that a rule creates after `PushDownFilter` has run in a pass stays above a pure extraction projection until the next pass. I could not build that shape from SQL. A test with a `TableProvider` that answers `Exact` is a follow-up, because that is the case where a filter node absorbed in pass 1 cannot be recovered later. ## What changes are included in this PR? - `rewrite_projection` in `push_down_filter.rs` returns the filter unchanged when the projection is a pure extraction projection. This is the whole behaviour change. - `is_pure_extraction_projection` in `extract_leaf_expressions.rs` is now `pub(crate)` and takes the expression list, so both rules use one predicate. - The precedence is recorded as an invariant in the module documentation of both rules, and in a new "Rule Precedence" section in `docs/source/library-user-guide/query-optimizer.md`. No new public API and no new configuration option. ## What is the testing strategy for this PR? - Two unit tests in `push_down_filter.rs`: `filter_not_pushed_through_pure_extraction_projection` shows the pair does not move, and `filter_pushed_through_mixed_extraction_projection` shows a projection that also computes an expression is still pushed through. - An observer test in `push_down_filter.rs`, `filter_and_extraction_projection_reach_fixed_point`, runs the default optimizer and records which rules change the plan in each pass. It fails if `PushDownFilter` or `PushDownLeafProjections` changes the plan in the last pass. It fails on `main` and passes with this PR. - A new section in `datafusion/sqllogictest/test_files/projection_pushdown.slt`: - the apache#14540 query on a memory table, with its final `EXPLAIN` plan; - a determinism check. The simple shape gives the same plan at `datafusion.optimizer.max_passes = 1` as at the default. The apache#14540 shape gives the same plan at `max_passes = 2` as at the default. Two passes are needed there because the two filters merge in the second pass, which is real work and not a rule fight; - a correctness query over the same data; - a Parquet backed check, where `DataSourceExec` shows both the `get_field` leaf projection and the `date` predicate. Commands run: - `cargo test --profile ci -p datafusion-optimizer` -> 882 passed, 0 failed (lib), 26 passed (integration), 5 passed / 1 ignored (doctests). - `cargo test --profile ci -p datafusion-sqllogictest --test sqllogictests` -> 520 of 520 files pass. - `cargo clippy --profile ci -p datafusion-optimizer --all-targets -- -D warnings` -> clean. - `RUSTDOCFLAGS="-D warnings" cargo doc --profile ci -p datafusion-optimizer --no-deps` -> clean. - The extended workspace test command (`--workspace --lib --tests --bins` with `avro,json,backtrace,extended_tests,recursive_protection,parquet_encryption`, without `datafusion-examples`, `datafusion-benchmarks`, `datafusion-cli` and `datafusion-sqllogictest`) -> 68 suites, 11910 passed, 0 failed, 8 ignored. ### Changed expectations Two lines in `projection_pushdown.slt` change. Both are in queries that the fight used to rewrite. 1. Line 1058, `EXPLAIN SELECT s['value'] * 2 + length(s['label']) as score FROM simple_struct WHERE id > 1;`. The plan shape does not change. The alias inside the cast is no longer stripped: `CAST(character_length(...) AS Int64)` becomes `CAST(character_length(...) AS length(get_field(simple_struct.s, Utf8("label"))) AS Int64)`. The SQL planner writes `length(x)` as `character_length(x) AS length(x)`, and the coercion pass wraps that alias in the cast. On `main` this alias is visible too, with no struct and no extraction: `EXPLAIN SELECT a * 2 + length(b) AS score FROM tt;` prints `CAST(character_length(tt.b) AS length(tt.b) AS Int64)`. It only disappeared in this test because the extra projection merge that the rule fight caused removed it. The physical plan is identical. 2. Line 2308, a `TableScan` loses a `Boolean(true)` entry from `partial_filters`. The entry was a no-op. ## Are there any user-facing changes? The logical plan of a query that reads a struct field and filters on another column changes shape. The filter node now sits above the extraction projection instead of below it. Results do not change, and the physical plan keeps both the leaf projection and the scan predicate. Part of the leaf-pushdown EPIC: apache#25459 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
1 parent 1f2064a commit 6893e0d

4 files changed

Lines changed: 455 additions & 22 deletions

File tree

‎datafusion/optimizer/src/extract_leaf_expressions.rs‎

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,41 @@
1919
//! access `user['status']`) closer to data sources, enabling early data reduction
2020
//! and source-level optimizations (e.g., Parquet column pruning). See
2121
//! [`ExtractLeafExpressions`] (pass 1) and [`PushDownLeafProjections`] (pass 2).
22+
//!
23+
//! # Precedence over [`PushDownFilter`]
24+
//!
25+
//! [`PushDownLeafProjections`] and [`PushDownFilter`] both move nodes towards
26+
//! the leaves, and for an adjacent filter and *pure extraction projection* (a
27+
//! projection whose expressions are only `__datafusion_extracted_N` aliases and
28+
//! pass-through columns) they want the opposite order:
29+
//!
30+
//! ```text
31+
//! Filter: t.date = '2025-01-03' <-- (A)
32+
//! Projection: get_field(t.ids, 'id1') AS __datafusion_extracted_1, t.date <-- (B)
33+
//! TableScan: t
34+
//! ```
35+
//!
36+
//! `PushDownFilter` wants (A) below (B). `PushDownLeafProjections` wants (B)
37+
//! below (A). Before <https://github.com/apache/datafusion/issues/14540> was
38+
//! decided the two rules undid each other on every optimizer pass, and the rule
39+
//! that runs later in the list won.
40+
//!
41+
//! **Invariant: pure extraction projections win.** `PushDownFilter` does not
42+
//! move a filter below a pure extraction projection, so the plan above is the
43+
//! final plan. `PushDownLeafProjections` keeps moving such a projection through
44+
//! a filter, which is how the projection reaches the scan.
45+
//!
46+
//! The reason is that the extraction projection is the node a source absorbs.
47+
//! A Parquet scan merges it into the file projection and reads only the struct
48+
//! leaf. With the opposite precedence the scan reads the whole struct whenever
49+
//! `datafusion.execution.parquet.pushdown_filters` is `false`, which is the
50+
//! default. The filter loses nothing by staying one node higher, because
51+
//! `PushDownFilter` records the predicate in
52+
//! [`TableScan::filters`](datafusion_expr::logical_plan::TableScan) in the pass
53+
//! that runs before the extraction projection exists, so row group pruning and
54+
//! source level filtering still happen.
55+
//!
56+
//! [`PushDownFilter`]: crate::push_down_filter::PushDownFilter
2257
2358
use indexmap::{IndexMap, IndexSet};
2459
use std::collections::{BTreeSet, HashMap};
@@ -1151,15 +1186,18 @@ fn split_and_push_projection(
11511186
}
11521187
}
11531188

1154-
/// Returns true if the plan is a Projection where ALL expressions are either
1155-
/// `Alias(EXTRACTED_EXPR_PREFIX, ...)` or `Column`, with at least one extraction.
1189+
/// Returns true if `exprs` are the expressions of a *pure extraction
1190+
/// projection*: every expression is either `Alias(EXTRACTED_EXPR_PREFIX, ...)`
1191+
/// or a bare `Column`, and there is at least one extraction alias.
1192+
///
11561193
/// Such projections can safely be pushed further without re-extraction.
1157-
fn is_pure_extraction_projection(plan: &LogicalPlan) -> bool {
1158-
let LogicalPlan::Projection(proj) = plan else {
1159-
return false;
1160-
};
1194+
///
1195+
/// [`PushDownFilter`](crate::push_down_filter::PushDownFilter) uses the same
1196+
/// predicate to keep a filter above such a projection. See the module
1197+
/// documentation for the precedence rule.
1198+
pub(crate) fn is_pure_extraction_projection(exprs: &[Expr]) -> bool {
11611199
let mut has_extraction = false;
1162-
for expr in &proj.expr {
1200+
for expr in exprs {
11631201
match expr {
11641202
Expr::Alias(alias) if alias.name.starts_with(EXTRACTED_EXPR_PREFIX) => {
11651203
has_extraction = true;
@@ -1196,6 +1234,7 @@ fn push_extraction_pairs(
11961234
proj_input,
11971235
target_schema.as_ref(),
11981236
)?;
1237+
let merged_is_pure = is_pure_extraction_projection(&merged.expr);
11991238
let merged_plan = LogicalPlan::Projection(merged);
12001239

12011240
// After merging, try to push the result further down, but ONLY
@@ -1206,7 +1245,7 @@ fn push_extraction_pairs(
12061245
// the (None, true) fallback can't find the original aliases.
12071246
// This handles: Extraction → Recovery(cols) → Filter → ... → TableScan
12081247
// by pushing through the recovery projection AND the filter in one pass.
1209-
if is_pure_extraction_projection(&merged_plan)
1248+
if merged_is_pure
12101249
&& let Some(pushed) = try_push_input(&merged_plan, alias_generator)?
12111250
{
12121251
return Ok(Some(pushed));
@@ -3657,14 +3696,11 @@ mod tests {
36573696
fn test_is_pure_extraction_projection() -> Result<()> {
36583697
let scan = test_table_scan_with_struct()?;
36593698

3660-
// Not a projection.
3661-
assert!(!is_pure_extraction_projection(&scan));
3662-
36633699
// Columns only: nothing was extracted.
36643700
let columns_only = LogicalPlanBuilder::from(scan.clone())
36653701
.project(vec![col("id"), col("user")])?
36663702
.build()?;
3667-
assert!(!is_pure_extraction_projection(&columns_only));
3703+
assert!(!is_pure_extraction_projection(&columns_only.expressions()));
36683704

36693705
// One extraction alias and one pass-through column.
36703706
let pure = LogicalPlanBuilder::from(scan.clone())
@@ -3673,7 +3709,7 @@ mod tests {
36733709
col("id"),
36743710
])?
36753711
.build()?;
3676-
assert!(is_pure_extraction_projection(&pure));
3712+
assert!(is_pure_extraction_projection(&pure.expressions()));
36773713

36783714
// The same shape under a `CommonSubexprEliminate` alias is not an
36793715
// extraction projection.
@@ -3683,13 +3719,13 @@ mod tests {
36833719
col("id"),
36843720
])?
36853721
.build()?;
3686-
assert!(!is_pure_extraction_projection(&common_expr));
3722+
assert!(!is_pure_extraction_projection(&common_expr.expressions()));
36873723

36883724
// A bare expression is never allowed.
36893725
let bare_expr = LogicalPlanBuilder::from(scan)
36903726
.project(vec![leaf_udf(col("user"), "status"), col("id")])?
36913727
.build()?;
3692-
assert!(!is_pure_extraction_projection(&bare_expr));
3728+
assert!(!is_pure_extraction_projection(&bare_expr.expressions()));
36933729

36943730
Ok(())
36953731
}

‎datafusion/optimizer/src/push_down_filter.rs‎

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,28 @@
1616
// under the License.
1717

1818
//! [`PushDownFilter`] applies filters as early as possible
19+
//!
20+
//! # Precedence: pure extraction projections win
21+
//!
22+
//! [`PushDownLeafProjections`] moves a *pure extraction projection* towards the
23+
//! leaves. Such a projection has only `__datafusion_extracted_N` aliases and
24+
//! pass-through columns. [`PushDownFilter`] moves filters towards the leaves
25+
//! too. For an adjacent filter and pure extraction projection the two rules
26+
//! want the opposite order, so they undo each other on every optimizer pass.
27+
//!
28+
//! **Invariant: `PushDownFilter` yields to a pure extraction projection.** A
29+
//! filter is never moved below such a projection. The extraction projection
30+
//! stays at the bottom of the plan, next to the scan, and the filter stays
31+
//! above it.
32+
//!
33+
//! The reason is that the extraction projection is the node a source absorbs.
34+
//! A Parquet scan merges it into the file projection and reads only the struct
35+
//! leaf, which is what the rule exists for. Keeping the filter one node higher
36+
//! costs nothing at the scan, because `PushDownFilter` records the predicate in
37+
//! [`TableScan::filters`](datafusion_expr::logical_plan::TableScan) in the pass
38+
//! that runs before the extraction projection exists.
39+
//!
40+
//! [`PushDownLeafProjections`]: crate::extract_leaf_expressions::PushDownLeafProjections
1941
2042
use std::collections::{HashMap, HashSet};
2143
use std::sync::Arc;
@@ -44,6 +66,7 @@ use datafusion_expr::{
4466
TableProviderFilterPushDown, and, or,
4567
};
4668

69+
use crate::extract_leaf_expressions::is_pure_extraction_projection;
4770
use crate::optimizer::ApplyOrder;
4871
use crate::simplify_expressions::{reorder_predicates, simplify_predicates};
4972
use crate::utils::{
@@ -1424,6 +1447,27 @@ fn rewrite_projection(
14241447
predicates: Vec<Expr>,
14251448
mut projection: Projection,
14261449
) -> Result<(Transformed<LogicalPlan>, Vec<Expr>)> {
1450+
// Precedence rule: a filter never moves below a pure extraction projection.
1451+
//
1452+
// `PushDownLeafProjections` moves such a projection below an adjacent
1453+
// filter, so a filter that moved below it is put back above it in the same
1454+
// optimizer pass. The two rules then undo each other on every pass until
1455+
// the pass limit stops them, and the surviving plan is decided by rule
1456+
// order alone. `PushDownFilter` yields here, because the extraction
1457+
// projection is the node the source absorbs: leaving it at the bottom keeps
1458+
// Parquet struct field pruning, and a filter kept one node higher still
1459+
// reaches the scan through `TableScan::filters`, which the pass that
1460+
// created the extraction projection has already set.
1461+
//
1462+
// See the module documentation of `extract_leaf_expressions` for the
1463+
// full statement of the invariant.
1464+
if is_pure_extraction_projection(&projection.expr) {
1465+
return Ok((
1466+
Transformed::no(LogicalPlan::Projection(projection)),
1467+
predicates,
1468+
));
1469+
}
1470+
14271471
// Partition projection expressions into non-pushable vs pushable.
14281472
// Non-pushable expressions are volatile (must not be duplicated) or
14291473
// MoveTowardsLeafNodes (cheap expressions like get_field where re-inlining
@@ -4666,6 +4710,129 @@ mod tests {
46664710
)
46674711
}
46684712

4713+
/// A filter is not moved below a pure extraction projection, even when its
4714+
/// predicate only references pass-through columns.
4715+
///
4716+
/// `PushDownLeafProjections` moves such a projection back below the filter,
4717+
/// so pushing here would make the two rules undo each other on every
4718+
/// optimizer pass. See <https://github.com/apache/datafusion/issues/14540>
4719+
/// and the module documentation.
4720+
#[test]
4721+
fn filter_not_pushed_through_pure_extraction_projection() -> Result<()> {
4722+
let table_scan = test_table_scan()?;
4723+
4724+
// The shape `ExtractLeafExpressions` produces: one extraction alias
4725+
// plus pass-through columns.
4726+
let proj = LogicalPlanBuilder::from(table_scan)
4727+
.project(vec![
4728+
leaf_udf_expr(col("a")).alias("__datafusion_extracted_1"),
4729+
col("b"),
4730+
col("c"),
4731+
])?
4732+
.build()?;
4733+
4734+
// `b` is a plain pass-through column, so without the precedence rule
4735+
// this predicate would reach the scan as a `full_filters` entry.
4736+
let plan = LogicalPlanBuilder::from(proj)
4737+
.filter(col("b").gt(lit(5i64)))?
4738+
.build()?;
4739+
4740+
assert_optimized_plan_equal!(
4741+
plan,
4742+
@r"
4743+
Filter: test.b > Int64(5)
4744+
Projection: leaf_udf(test.a) AS __datafusion_extracted_1, test.b, test.c
4745+
TableScan: test
4746+
"
4747+
)
4748+
}
4749+
4750+
/// Runs the default optimizer and returns, for each pass, the names of the
4751+
/// rules that changed the plan in that pass.
4752+
fn rules_that_changed_plan_per_pass(plan: LogicalPlan) -> Result<Vec<Vec<String>>> {
4753+
let optimizer = Optimizer::new();
4754+
let rules_per_pass = optimizer.rules.len();
4755+
let mut previous = plan.display_indent().to_string();
4756+
let mut calls = 0;
4757+
let mut passes: Vec<Vec<String>> = vec![];
4758+
optimizer.optimize(plan, &OptimizerContext::new(), |plan, rule| {
4759+
if calls % rules_per_pass == 0 {
4760+
passes.push(vec![]);
4761+
}
4762+
calls += 1;
4763+
let current = plan.display_indent().to_string();
4764+
if current != previous {
4765+
passes.last_mut().unwrap().push(rule.name().to_string());
4766+
previous = current;
4767+
}
4768+
})?;
4769+
Ok(passes)
4770+
}
4771+
4772+
/// `PushDownFilter` and `PushDownLeafProjections` must not undo each other
4773+
/// for a filter next to a pure extraction projection
4774+
/// (<https://github.com/apache/datafusion/issues/14540>). Neither rule may
4775+
/// change the plan in the last optimizer pass. The source does not absorb
4776+
/// filters, so the `Filter` node stays in the plan.
4777+
#[test]
4778+
fn filter_and_extraction_projection_reach_fixed_point() -> Result<()> {
4779+
let scan = || {
4780+
table_scan_with_pushdown_provider_builder(
4781+
TableProviderFilterPushDown::Unsupported,
4782+
vec![],
4783+
None,
4784+
)
4785+
};
4786+
let simple = scan()?
4787+
.filter(col("b").gt(lit(5)))?
4788+
.project(vec![leaf_udf_expr(col("a"))])?
4789+
.build()?;
4790+
// Two filters, one of them on an extracted leaf.
4791+
let two_filters = scan()?
4792+
.filter(col("b").gt(lit(5)))?
4793+
.filter(leaf_udf_expr(col("a")).eq(lit(1)))?
4794+
.project(vec![leaf_udf_expr(col("a")), col("b")])?
4795+
.build()?;
4796+
4797+
for plan in [simple, two_filters] {
4798+
let passes = rules_that_changed_plan_per_pass(plan)?;
4799+
let last = passes.last().unwrap();
4800+
assert!(
4801+
!last.iter().any(|rule| rule == "push_down_filter"
4802+
|| rule == "push_down_leaf_projections"),
4803+
"pushdown rules changed the plan in the last pass: {passes:?}"
4804+
);
4805+
}
4806+
Ok(())
4807+
}
4808+
4809+
/// A projection that mixes an extraction alias with a computed expression is
4810+
/// not a pure extraction projection, so the filter still moves below it.
4811+
#[test]
4812+
fn filter_pushed_through_mixed_extraction_projection() -> Result<()> {
4813+
let table_scan = test_table_scan()?;
4814+
4815+
let proj = LogicalPlanBuilder::from(table_scan)
4816+
.project(vec![
4817+
leaf_udf_expr(col("a")).alias("__datafusion_extracted_1"),
4818+
(col("b") + lit(1i64)).alias("b_plus"),
4819+
col("c"),
4820+
])?
4821+
.build()?;
4822+
4823+
let plan = LogicalPlanBuilder::from(proj)
4824+
.filter(col("c").gt(lit(5i64)))?
4825+
.build()?;
4826+
4827+
assert_optimized_plan_equal!(
4828+
plan,
4829+
@r"
4830+
Projection: leaf_udf(test.a) AS __datafusion_extracted_1, test.b + Int64(1) AS b_plus, test.c
4831+
TableScan: test, full_filters=[test.c > Int64(5)]
4832+
"
4833+
)
4834+
}
4835+
46694836
#[test]
46704837
fn filter_not_pushed_down_through_table_scan_with_fetch() -> Result<()> {
46714838
let scan = test_table_scan()?;

0 commit comments

Comments
 (0)