-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
UNION ALL bug: thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', ./src/datatypes/schema.rs:165:10 #1064
Comments
Thanks for your report !@omegablitz |
This issue is actually reproducible with the following (simpler) query:
|
Full trace
|
This one looks like it might be a good one for someone who wants to understand schemas and column references |
The idx is wrapped in physical expr and is used in https://github.com/apache/arrow-datafusion/blob/4687899957463ce81c4795a6d35d31320db0252b/datafusion/src/physical_plan/type_coercion.rs#L56 Pay attention to the The direct way from my brain is to get the idx of the column from the physical input schema, select
sum(l_extendedprice * l_discount) as revenue
from
lineitem
where
l_shipdate >= date '1994-01-01'
and l_shipdate < date '1995-01-01'
and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24; [datafusion/src/physical_plan/planner.rs:836] c = Column {
relation: None,
name: "SUM(lineitem.l_extendedprice * lineitem.l_discount)",
}
[datafusion/src/physical_plan/planner.rs:837] input_dfschema = DFSchema {
fields: [
DFField {
qualifier: None,
field: Field {
name: "SUM(lineitem.l_extendedprice * lineitem.l_discount)",
data_type: Float64,
nullable: true,
dict_id: 0,
dict_is_ordered: false,
metadata: None,
},
},
],
}
[datafusion/src/physical_plan/planner.rs:838] input_schema = Schema {
fields: [
Field {
name: "SUM(lineitem.l_extendedprice Multiply lineitem.l_discount)",
data_type: Float64,
nullable: true,
dict_id: 0,
dict_is_ordered: false,
metadata: None,
},
],
metadata: {},
} The second way is to wrap the union logical plan into a projection plan, but maybe the logical plan will be optimized. For the case mentioned by @Dandandan, the projection plan wrapped on the union logical plan will be optimized and only contains The third way is trying! |
Thanks for the great library! Ran into the following issue while testing out some queries:
Describe the bug
UNION ALL does not give expected results when combining two tables. The minimal reproduction provided below panics.
To Reproduce
Minimal repro available here:
https://github.com/omegablitz/datafusion-bug
Expected behavior
I expect the output to be:
Instead, this example panics.
Additional context
If I explicitly change:
to:
it works
The text was updated successfully, but these errors were encountered: