Skip to content

Commit

Permalink
Minor: fix: #9010 - Optimizer schema change assert error is incorrect (
Browse files Browse the repository at this point in the history
…#9012)

* fix: #9010 - Optimizer schema change assert error has incorrect error

* test: #9010 flip expected order of schema change errors
  • Loading branch information
curtisleefulton authored Jan 26, 2024
1 parent c42bf48 commit fc75255
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions datafusion/optimizer/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl Optimizer {
self.optimize_recursively(rule, &new_plan, config)
.and_then(|plan| {
if let Some(plan) = &plan {
assert_schema_is_the_same(rule.name(), &new_plan, plan)?;
assert_schema_is_the_same(rule.name(), plan, &new_plan)?;
}
Ok(plan)
});
Expand Down Expand Up @@ -501,15 +501,14 @@ mod tests {
let err = opt.optimize(&plan, &config, &observe).unwrap_err();
assert_eq!(
"Optimizer rule 'get table_scan rule' failed\ncaused by\nget table_scan rule\ncaused by\n\
Internal error: Failed due to a difference in schemas, \
original schema: DFSchema { fields: [], metadata: {}, functional_dependencies: FunctionalDependencies { deps: [] } }, \
new schema: DFSchema { fields: [\
DFField { qualifier: Some(Bare { table: \"test\" }), field: Field { name: \"a\", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }, \
DFField { qualifier: Some(Bare { table: \"test\" }), field: Field { name: \"b\", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }, \
DFField { qualifier: Some(Bare { table: \"test\" }), field: Field { name: \"c\", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }], \
metadata: {}, functional_dependencies: FunctionalDependencies { deps: [] } }.\
\nThis was likely caused by a bug in DataFusion's code \
and we would welcome that you file an bug report in our issue tracker",
Internal error: Failed due to a difference in schemas, \
original schema: DFSchema { fields: [\
DFField { qualifier: Some(Bare { table: \"test\" }), field: Field { name: \"a\", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }, \
DFField { qualifier: Some(Bare { table: \"test\" }), field: Field { name: \"b\", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }, \
DFField { qualifier: Some(Bare { table: \"test\" }), field: Field { name: \"c\", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }], \
metadata: {}, functional_dependencies: FunctionalDependencies { deps: [] } }, \
new schema: DFSchema { fields: [], metadata: {}, functional_dependencies: FunctionalDependencies { deps: [] } }.\
\nThis was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker",
err.strip_backtrace()
);
}
Expand Down

0 comments on commit fc75255

Please sign in to comment.