Skip to content

Add more struct pushdown tests and planning benchmark#20143

Merged
adriangb merged 2 commits intoapache:mainfrom
pydantic:more-tests
Feb 4, 2026
Merged

Add more struct pushdown tests and planning benchmark#20143
adriangb merged 2 commits intoapache:mainfrom
pydantic:more-tests

Conversation

@adriangb
Copy link
Contributor

@adriangb adriangb commented Feb 4, 2026

Pulling out of #20117

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Feb 4, 2026
@adriangb
Copy link
Contributor Author

adriangb commented Feb 4, 2026

run benchmarks sql_planner

@alamb-ghbot
Copy link

🤖 Hi @adriangb, thanks for the request (#20143 (comment)).

scrape_comments.py only supports whitelisted benchmarks.

  • Standard: clickbench_1, clickbench_extended, clickbench_partitioned, clickbench_pushdown, external_aggr, tpcds, tpch, tpch10, tpch_mem, tpch_mem10
  • Criterion: aggregate_query_sql, aggregate_vectorized, case_when, character_length, in_list, left, range_and_generate_series, reset_plan_states, sort, sql_planner, strpos, substr_index, with_hashes

Please choose one or more of these with run benchmark <name> or run benchmark <name1> <name2>...

@adriangb
Copy link
Contributor Author

adriangb commented Feb 4, 2026

run benchmark sql_planner

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch_bench.sh compare_branch_bench.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing more-tests (b44626d) to b80bf2c diff
BENCH_NAME=sql_planner
BENCH_COMMAND=cargo bench --features=parquet --bench sql_planner
BENCH_FILTER=
BENCH_BRANCH_NAME=more-tests
Results will be posted here when complete

@adriangb
Copy link
Contributor Author

adriangb commented Feb 4, 2026

show benchmark queue

@alamb-ghbot
Copy link

🤖 Hi @adriangb, you asked to view the benchmark queue (#20143 (comment)).

Job User Benchmarks Comment
20143_3847387750.sh adriangb sql_planner https://github.com/apache/datafusion/pull/20143#issuecomment-3847387750

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

group                                                 main                                   more-tests
-----                                                 ----                                   ----------
logical_aggregate_with_join                           1.01   641.5±11.33µs        ? ?/sec    1.00   636.4±12.16µs        ? ?/sec
logical_plan_struct_join_agg_sort                                                            1.00    291.9±6.18µs        ? ?/sec
logical_select_all_from_1000                          1.00     10.7±0.21ms        ? ?/sec    1.00     10.7±0.14ms        ? ?/sec
logical_select_one_from_700                           1.00    420.4±3.79µs        ? ?/sec    1.00    419.1±8.61µs        ? ?/sec
logical_trivial_join_high_numbered_columns            1.01   378.9±13.28µs        ? ?/sec    1.00    374.6±2.56µs        ? ?/sec
logical_trivial_join_low_numbered_columns             1.01    363.0±5.79µs        ? ?/sec    1.00    360.4±3.67µs        ? ?/sec
physical_intersection                                 1.00  1599.7±21.05µs        ? ?/sec    1.00  1599.4±17.32µs        ? ?/sec
physical_join_consider_sort                           1.01      2.3±0.02ms        ? ?/sec    1.00      2.3±0.05ms        ? ?/sec
physical_join_distinct                                1.00    353.2±2.67µs        ? ?/sec    1.00    351.9±5.71µs        ? ?/sec
physical_many_self_joins                              1.01     12.6±0.13ms        ? ?/sec    1.00     12.5±0.14ms        ? ?/sec
physical_plan_clickbench_all                          1.01    201.2±1.74ms        ? ?/sec    1.00    200.0±2.44ms        ? ?/sec
physical_plan_clickbench_q1                           1.01      2.1±0.01ms        ? ?/sec    1.00      2.1±0.02ms        ? ?/sec
physical_plan_clickbench_q10                          1.01      3.6±0.05ms        ? ?/sec    1.00      3.6±0.05ms        ? ?/sec
physical_plan_clickbench_q11                          1.01      4.1±0.09ms        ? ?/sec    1.00      4.1±0.09ms        ? ?/sec
physical_plan_clickbench_q12                          1.00      4.2±0.08ms        ? ?/sec    1.00      4.2±0.11ms        ? ?/sec
physical_plan_clickbench_q13                          1.00      3.8±0.06ms        ? ?/sec    1.00      3.7±0.08ms        ? ?/sec
physical_plan_clickbench_q14                          1.00      4.1±0.07ms        ? ?/sec    1.00      4.2±0.06ms        ? ?/sec
physical_plan_clickbench_q15                          1.01      3.8±0.04ms        ? ?/sec    1.00      3.8±0.05ms        ? ?/sec
physical_plan_clickbench_q16                          1.00      3.7±0.08ms        ? ?/sec    1.00      3.7±0.08ms        ? ?/sec
physical_plan_clickbench_q17                          1.00      3.8±0.04ms        ? ?/sec    1.00      3.8±0.08ms        ? ?/sec
physical_plan_clickbench_q18                          1.00      2.7±0.07ms        ? ?/sec    1.00      2.6±0.02ms        ? ?/sec
physical_plan_clickbench_q19                          1.00      4.2±0.12ms        ? ?/sec    1.01      4.2±0.04ms        ? ?/sec
physical_plan_clickbench_q2                           1.01      2.8±0.02ms        ? ?/sec    1.00      2.8±0.06ms        ? ?/sec
physical_plan_clickbench_q20                          1.00      2.2±0.05ms        ? ?/sec    1.00      2.2±0.06ms        ? ?/sec
physical_plan_clickbench_q21                          1.00      2.8±0.04ms        ? ?/sec    1.00      2.8±0.05ms        ? ?/sec
physical_plan_clickbench_q22                          1.00      3.9±0.04ms        ? ?/sec    1.00      3.9±0.13ms        ? ?/sec
physical_plan_clickbench_q23                          1.00      4.2±0.05ms        ? ?/sec    1.00      4.2±0.11ms        ? ?/sec
physical_plan_clickbench_q24                          1.00      4.8±0.14ms        ? ?/sec    1.00      4.8±0.04ms        ? ?/sec
physical_plan_clickbench_q25                          1.00      3.5±0.06ms        ? ?/sec    1.00      3.5±0.06ms        ? ?/sec
physical_plan_clickbench_q26                          1.01      2.9±0.10ms        ? ?/sec    1.00      2.9±0.06ms        ? ?/sec
physical_plan_clickbench_q27                          1.00      3.5±0.04ms        ? ?/sec    1.00      3.5±0.04ms        ? ?/sec
physical_plan_clickbench_q28                          1.00      4.5±0.15ms        ? ?/sec    1.00      4.5±0.05ms        ? ?/sec
physical_plan_clickbench_q29                          1.00      4.7±0.05ms        ? ?/sec    1.01      4.8±0.19ms        ? ?/sec
physical_plan_clickbench_q3                           1.00      2.5±0.03ms        ? ?/sec    1.00      2.5±0.02ms        ? ?/sec
physical_plan_clickbench_q30                          1.00     15.5±0.19ms        ? ?/sec    1.01     15.7±0.30ms        ? ?/sec
physical_plan_clickbench_q31                          1.00      4.5±0.07ms        ? ?/sec    1.00      4.5±0.08ms        ? ?/sec
physical_plan_clickbench_q32                          1.01      4.5±0.05ms        ? ?/sec    1.00      4.4±0.03ms        ? ?/sec
physical_plan_clickbench_q33                          1.00      3.6±0.03ms        ? ?/sec    1.00      3.6±0.08ms        ? ?/sec
physical_plan_clickbench_q34                          1.00      3.2±0.04ms        ? ?/sec    1.00      3.2±0.03ms        ? ?/sec
physical_plan_clickbench_q35                          1.00      3.4±0.02ms        ? ?/sec    1.01      3.4±0.05ms        ? ?/sec
physical_plan_clickbench_q36                          1.00      4.2±0.05ms        ? ?/sec    1.00      4.2±0.12ms        ? ?/sec
physical_plan_clickbench_q37                          1.00      4.7±0.06ms        ? ?/sec    1.00      4.7±0.10ms        ? ?/sec
physical_plan_clickbench_q38                          1.00      4.7±0.04ms        ? ?/sec    1.00      4.6±0.05ms        ? ?/sec
physical_plan_clickbench_q39                          1.00      4.1±0.07ms        ? ?/sec    1.00      4.1±0.05ms        ? ?/sec
physical_plan_clickbench_q4                           1.01      2.2±0.02ms        ? ?/sec    1.00      2.2±0.08ms        ? ?/sec
physical_plan_clickbench_q40                          1.01      4.9±0.17ms        ? ?/sec    1.00      4.9±0.06ms        ? ?/sec
physical_plan_clickbench_q41                          1.00      4.3±0.09ms        ? ?/sec    1.00      4.3±0.09ms        ? ?/sec
physical_plan_clickbench_q42                          1.01      4.2±0.06ms        ? ?/sec    1.00      4.2±0.05ms        ? ?/sec
physical_plan_clickbench_q43                          1.00      4.5±0.05ms        ? ?/sec    1.00      4.6±0.07ms        ? ?/sec
physical_plan_clickbench_q44                          1.00      2.3±0.05ms        ? ?/sec    1.00      2.3±0.02ms        ? ?/sec
physical_plan_clickbench_q45                          1.00      2.3±0.04ms        ? ?/sec    1.00      2.3±0.03ms        ? ?/sec
physical_plan_clickbench_q46                          1.00      3.2±0.10ms        ? ?/sec    1.00      3.2±0.02ms        ? ?/sec
physical_plan_clickbench_q47                          1.00      4.7±0.07ms        ? ?/sec    1.00      4.7±0.05ms        ? ?/sec
physical_plan_clickbench_q48                          1.00      5.1±0.06ms        ? ?/sec    1.00      5.1±0.08ms        ? ?/sec
physical_plan_clickbench_q49                          1.01      5.4±0.08ms        ? ?/sec    1.00      5.4±0.09ms        ? ?/sec
physical_plan_clickbench_q5                           1.01      2.6±0.04ms        ? ?/sec    1.00      2.5±0.05ms        ? ?/sec
physical_plan_clickbench_q50                          1.00      4.1±0.03ms        ? ?/sec    1.00      4.1±0.05ms        ? ?/sec
physical_plan_clickbench_q51                          1.00      3.5±0.04ms        ? ?/sec    1.00      3.5±0.02ms        ? ?/sec
physical_plan_clickbench_q6                           1.00      2.5±0.03ms        ? ?/sec    1.00      2.5±0.07ms        ? ?/sec
physical_plan_clickbench_q7                           1.01      2.1±0.02ms        ? ?/sec    1.00      2.1±0.02ms        ? ?/sec
physical_plan_clickbench_q8                           1.00      3.5±0.03ms        ? ?/sec    1.01      3.5±0.11ms        ? ?/sec
physical_plan_clickbench_q9                           1.01      3.6±0.03ms        ? ?/sec    1.00      3.6±0.02ms        ? ?/sec
physical_plan_struct_join_agg_sort                                                           1.00      2.7±0.03ms        ? ?/sec
physical_plan_tpcds_all                               1.00  1915.9±12.10ms        ? ?/sec    1.00  1915.7±12.55ms        ? ?/sec
physical_plan_tpch_all                                1.00    125.8±0.99ms        ? ?/sec    1.00    126.0±0.83ms        ? ?/sec
physical_plan_tpch_q1                                 1.00      3.0±0.03ms        ? ?/sec    1.00      3.0±0.04ms        ? ?/sec
physical_plan_tpch_q10                                1.00      7.3±0.08ms        ? ?/sec    1.00      7.3±0.14ms        ? ?/sec
physical_plan_tpch_q11                                1.00      8.5±0.06ms        ? ?/sec    1.01      8.6±0.06ms        ? ?/sec
physical_plan_tpch_q12                                1.00      3.1±0.07ms        ? ?/sec    1.00      3.1±0.03ms        ? ?/sec
physical_plan_tpch_q13                                1.00      3.0±0.07ms        ? ?/sec    1.00      3.0±0.05ms        ? ?/sec
physical_plan_tpch_q14                                1.00      3.1±0.02ms        ? ?/sec    1.01      3.1±0.03ms        ? ?/sec
physical_plan_tpch_q16                                1.00      5.2±0.10ms        ? ?/sec    1.00      5.2±0.05ms        ? ?/sec
physical_plan_tpch_q17                                1.00      5.6±0.05ms        ? ?/sec    1.00      5.6±0.11ms        ? ?/sec
physical_plan_tpch_q18                                1.00      5.9±0.07ms        ? ?/sec    1.01      5.9±0.05ms        ? ?/sec
physical_plan_tpch_q19                                1.00      5.0±0.07ms        ? ?/sec    1.00      5.0±0.07ms        ? ?/sec
physical_plan_tpch_q2                                 1.01     12.4±0.13ms        ? ?/sec    1.00     12.3±0.27ms        ? ?/sec
physical_plan_tpch_q20                                1.00      8.0±0.07ms        ? ?/sec    1.00      8.1±0.18ms        ? ?/sec
physical_plan_tpch_q21                                1.00     10.0±0.19ms        ? ?/sec    1.00     10.1±0.09ms        ? ?/sec
physical_plan_tpch_q22                                1.00      6.4±0.07ms        ? ?/sec    1.01      6.4±0.24ms        ? ?/sec
physical_plan_tpch_q3                                 1.00      5.6±0.05ms        ? ?/sec    1.00      5.6±0.04ms        ? ?/sec
physical_plan_tpch_q4                                 1.00      3.0±0.04ms        ? ?/sec    1.00      3.0±0.07ms        ? ?/sec
physical_plan_tpch_q5                                 1.01      6.0±0.07ms        ? ?/sec    1.00      5.9±0.05ms        ? ?/sec
physical_plan_tpch_q6                                 1.00  1596.7±16.78µs        ? ?/sec    1.00  1593.9±11.00µs        ? ?/sec
physical_plan_tpch_q7                                 1.00      7.2±0.09ms        ? ?/sec    1.01      7.2±0.07ms        ? ?/sec
physical_plan_tpch_q8                                 1.00      9.3±0.19ms        ? ?/sec    1.00      9.3±0.07ms        ? ?/sec
physical_plan_tpch_q9                                 1.00      6.7±0.16ms        ? ?/sec    1.00      6.7±0.07ms        ? ?/sec
physical_select_aggregates_from_200                   1.01     17.5±0.40ms        ? ?/sec    1.00     17.3±0.11ms        ? ?/sec
physical_select_all_from_1000                         1.01     23.9±0.22ms        ? ?/sec    1.00     23.7±0.34ms        ? ?/sec
physical_select_one_from_700                          1.01  1348.8±18.70µs        ? ?/sec    1.00   1330.7±7.25µs        ? ?/sec
physical_sorted_union_order_by_10_int64               1.00     11.0±0.11ms        ? ?/sec    1.02     11.2±0.11ms        ? ?/sec
physical_sorted_union_order_by_10_uint64              1.00     29.8±0.28ms        ? ?/sec    1.03     30.5±0.26ms        ? ?/sec
physical_sorted_union_order_by_50_int64               1.00    197.7±2.38ms        ? ?/sec    1.02    200.9±3.00ms        ? ?/sec
physical_sorted_union_order_by_50_uint64              1.00   1089.9±9.29ms        ? ?/sec    1.02  1115.2±13.13ms        ? ?/sec
physical_theta_join_consider_sort                     1.00      2.6±0.02ms        ? ?/sec    1.00      2.7±0.02ms        ? ?/sec
physical_unnest_to_join                               1.00      3.0±0.02ms        ? ?/sec    1.01      3.1±0.02ms        ? ?/sec
physical_window_function_partition_by_12_on_values    1.00  1574.1±14.35µs        ? ?/sec    1.01  1588.4±15.83µs        ? ?/sec
physical_window_function_partition_by_30_on_values    1.00      2.9±0.06ms        ? ?/sec    1.01      3.0±0.03ms        ? ?/sec
physical_window_function_partition_by_4_on_values     1.00   1094.0±9.87µs        ? ?/sec    1.00  1090.6±12.33µs        ? ?/sec
physical_window_function_partition_by_7_on_values     1.01   1266.6±8.85µs        ? ?/sec    1.00  1259.9±13.05µs        ? ?/sec
physical_window_function_partition_by_8_on_values     1.00   1326.1±6.86µs        ? ?/sec    1.01  1339.0±28.69µs        ? ?/sec
with_param_values_many_columns                        1.00   585.6±10.52µs        ? ?/sec    1.00    583.9±5.50µs        ? ?/sec

@adriangb
Copy link
Contributor Author

adriangb commented Feb 4, 2026

🤖: Benchmark completed
Details

Confirms the benchmarks run correctly!

.unwrap()
}

/// Create a table provider with a struct column: `id` (Int32) and `props` (Struct { value: Int32, label: Utf8 })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

logical_plan
01)Projection: get_field(simple_struct.s, Utf8("label"))
02)--TableScan: simple_struct projection=[s]
physical_plan DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/simple.parquet]]}, projection=[get_field(s@1, label) as simple_struct.s[label]], file_type=parquet
Copy link
Contributor

@comphead comphead Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so projection=[get_field(s@1, label) means the we extract label field from s structure column as earlier as possible, on the scan level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! In this case it "just works" because there's no filter, etc. in the way

physical_plan
01)HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(simple_struct.s[value]@2, join_right.s[level] * Int64(10)@2)], projection=[id@0, id@3]
02)--DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/simple.parquet]]}, projection=[id, s, get_field(s@1, value) as simple_struct.s[value]], file_type=parquet
03)--DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/join_right.parquet]]}, projection=[id, s, get_field(s@1, level) * 10 as join_right.s[level] * Int64(10)], file_type=parquet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 its outside of this PR but

get_field(s@1, level) * 10 as join_right.s[level] * Int64(10)

looks confusing, I would expect just

get_field(s@1, level) * 10

or we wanna preserve projection column generated names then

get_field(s@1, level) * 10 as [join_right.s[level] * Int64(10)]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually surprised this is getting pushed down into the scan here. I'm not sure what would cause that. It's not a bad thing but maybe we can evaluate if we should have the aliases there or not when we change this next time.

01)ProjectionExec: expr=[id@0 as id, get_field(s@1, label) as simple_struct.s[label], get_field(s@2, role) as join_right.s[role]]
02)--HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(id@0, id@0)], projection=[id@0, s@1, s@3]
03)----DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/simple.parquet]]}, projection=[id, s], file_type=parquet
04)----DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/projection_pushdown/join_right.parquet]]}, projection=[id, s], file_type=parquet, predicate=DynamicFilter [ empty ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we expect get_field pushdown here? or it is cheaper to bring the entire structure if many columns requested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we want pushdown here, it just doesn't work with the current status quo

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @adriangb it is LGTM

@adriangb adriangb added this pull request to the merge queue Feb 4, 2026
Merged via the queue into apache:main with commit 2f12f1c Feb 4, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants