Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying bind context can make unoptimized plans less readable in EXPLAIN #3344

Open
scsmithr opened this issue Dec 7, 2024 · 0 comments
Open
Labels
syntax Issues or features related to our SQL syntax

Comments

@scsmithr
Copy link
Member

scsmithr commented Dec 7, 2024

The <missing! #4.1> in this:

SELECT a, a-1, a-2, sum(b) FROM t1 GROUP BY a-1, a, a-2 ORDER BY a;
┌───────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ plan_type │ plan                                                                                                    │
│ Utf8      │ Utf8                                                                                                    │
├───────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ unoptimi… │ Project↵                                                                                                │
│           │   ├ cardinality: [unknown]↵                                                                             │
│           │   ├ location: Any↵                                                                                      │
│           │   ├ projections: [a, ?column?, ?column?, sum]↵                                                          │
│           │   ├ projections_raw: [#1.0, #1.1, #1.2, #1.3]↵                                                          │
│           │   └ table_ref: #5↵                                                                                      │
│           │   Order↵                                                                                                │
│           │     ├ cardinality: [unknown]↵                                                                           │
│           │     ├ expressions: [#1.4 asc nulls_first]↵                                                              │
│           │     └ location: Any↵                                                                                    │
│           │     Project↵                                                                                            │
│           │       ├ cardinality: [unknown]↵                                                                         │
│           │       ├ location: Any↵                                                                                  │
│           │       ├ projections: [<missing! #4.1>, __generated_group_1, <missing! #4.1> - 2, __generated_agg_ref,↵  │
│           │ <missing! #4.1>]↵                                                                                       │
│           │       ├ projections_raw: [#4.1, #4.0, #4.1 - 2, #2.0, #4.1]↵                                            │
│           │       └ table_ref: #1↵                                                                                  │
│           │       Aggregate↵                                                                                        │
│           │         ├ aggregates: [sum(CAST(b TO Int64))]↵                                                          │
│           │         ├ aggregates_raw: [sum(CAST(#0.1 TO Int64))]↵                                                   │
│           │         ├ cardinality: [unknown]↵                                                                       │
│           │         ├ group_expressions: [a - 1, a, a - 2]↵                                                         │
│           │         ├ group_expressions_raw: [#0.0 - 1, #0.0, #0.0 - 2]↵                                            │
│           │         ├ group_table_ref: #4↵                                                                          │
│           │         ├ location: Any↵                                                                                │
│           │         └ table_ref: #2↵                                                                                │
│           │         Scan↵                                                                                           │
│           │           ├ cardinality: [unknown]↵                                                                     │
│           │           ├ column_names: [a, b]↵                                                                       │
│           │           ├ column_types: [Int32, Int32]↵                                                               │
│           │           ├ location: ClientLocal↵                                                                      │
│           │           ├ projection: [0, 1]↵                                                                         │
│           │           ├ source: temp.temp.t1↵                                                                       │
│           │           └ table_ref: #0↵                                                                              │
│           │                                                                                                         │
│ optimized │ Project↵                                                                                                │
│           │   ├ cardinality: [unknown]↵                                                                             │
│           │   ├ location: Any↵                                                                                      │
│           │   ├ projections: [a, ?column?, ?column?, sum]↵                                                          │
│           │   ├ projections_raw: [#1.0, #1.1, #1.2, #1.3]↵                                                          │
│           │   └ table_ref: #5↵                                                                                      │
│           │   Order↵                                                                                                │
│           │     ├ cardinality: [unknown]↵                                                                           │
│           │     ├ expressions: [#1.4 asc nulls_first]↵                                                              │
│           │     └ location: Any↵                                                                                    │
│           │     Project↵                                                                                            │
│           │       ├ cardinality: [unknown]↵                                                                         │
│           │       ├ location: Any↵                                                                                  │
│           │       ├ projections: [__generated_group_1, __generated_group_1 - 1, __generated_group_1 - 2,↵           │
│           │ __generated_agg_ref, __generated_group_1]↵                                                              │
│           │       ├ projections_raw: [#4.0, #4.0 - 1, #4.0 - 2, #2.0, #4.0]↵                                        │
│           │       └ table_ref: #1↵                                                                                  │
│           │       Aggregate↵                                                                                        │
│           │         ├ aggregates: [sum(CAST(b TO Int64))]↵                                                          │
│           │         ├ aggregates_raw: [sum(CAST(#0.1 TO Int64))]↵                                                   │
│           │         ├ cardinality: [unknown]↵                                                                       │
│           │         ├ group_expressions: [a]↵                                                                       │
│           │         ├ group_expressions_raw: [#0.0]↵                                                                │
│           │         ├ group_table_ref: #4↵                                                                          │
│           │         ├ location: Any↵                                                                                │
│           │         └ table_ref: #2↵                                                                                │
│           │         Scan↵                                                                                           │
│           │           ├ cardinality: [unknown]↵                                                                     │
│           │           ├ column_names: [a, b]↵                                                                       │
│           │           ├ column_types: [Int32, Int32]↵                                                               │
│           │           ├ location: ClientLocal↵                                                                      │
│           │           ├ projection: [0, 1]↵                                                                         │
│           │           ├ source: temp.temp.t1↵                                                                       │
│           │           └ table_ref: #0↵                                                                              │
│           │                                                                                                         │
│ physical  │ IntermediatePipelineGroups↵                                                                             │
│           │   IntermediatePipelineGroup local↵                                                                      │
│           │     IntermediatePipeline 0↵                                                                             │
│           │       ├ Sink: InPipeline↵                                                                               │
│           │       └ Source: InPipeline↵                                                                             │
│           │       Scan↵                                                                                             │
│           │         ├ partitioning_requirement: None↵                                                               │
│           │         └ table: t1↵                                                                                    │
│           │       Project↵                                                                                          │
│           │         ├ partitioning_requirement: None↵                                                               │
│           │         └ projections: [CAST(@1 TO Int64), @0]↵                                                         │
│           │       HashAggregate↵                                                                                    │
│           │         ├ aggregate_columns: [0]↵                                                                       │
│           │         └ partitioning_requirement: None↵                                                               │
│           │       Project↵                                                                                          │
│           │         ├ partitioning_requirement: None↵                                                               │
│           │         └ projections: [@1, -(@1, 1), -(@1, 2), @0, @1]↵                                                │
│           │       BatchResizer↵                                                                                     │
│           │         └ partitioning_requirement: None↵                                                               │
│           │       ScatterSort↵                                                                                      │
│           │         └ partitioning_requirement: None↵                                                               │
│           │       GatherSort↵                                                                                       │
│           │         └ partitioning_requirement: None↵                                                               │
│           │     IntermediatePipeline 1↵                                                                             │
│           │       ├ Sink: QueryOutput↵                                                                              │
│           │       └ Source: OtherPipeline {pipeline_id: 0}↵                                                         │
│           │       Project↵                                                                                          │
│           │         ├ partitioning_requirement: None↵                                                               │
│           │         └ projections: [@0, @1, @2, @3]↵                                                                │
│           │   IntermediatePipelineGroup remote↵                                                                     │
│           │                                                                                                         │
└───────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────┘
@scsmithr scsmithr added the syntax Issues or features related to our SQL syntax label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax Issues or features related to our SQL syntax
Projects
None yet
Development

No branches or pull requests

1 participant