Repository navigation
Description
Describe the bug
Some passes may change the metadata for a plan and I think that is ok.
In paticular, we have a case in IOx where the projection_push_down actually exposes some more metadata (as it unwraps a projection that had masked it).
This new metadata actually fails with the newly added schema check added in #4233 by @jackwener. This currently causes our test to break
To Reproduce
Make a projection that doesn't do anything other than to mask some other plan that produces metadata
thread 'cases::test_cases_pushdown_sql' panicked at 'built plan successfully: Internal("Optimizer rule 'projection_push_down' failed, due to generate a different schema, original schema: DFSchema { fields: [DFField { qualifier: Some("restaurant"), field: Field { name: "count", data_type: UInt64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: None } }, DFField { qualifier: Some("restaurant"), field: Field { name: "system", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: None } }, DFField { qualifier: Some("restaurant"), field: Field { name: "time", data_type: Timestamp(Nanosecond, None), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: None } }, DFField { qualifier: Some("restaurant"), field: Field { name: "town", data_type: Dictionary(Int32, Utf8), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: None } }], metadata: {} }, new schema: DFSchema { fields: [DFField { qualifier: Some("restaurant"), field: Field { name: "count", data_type: UInt64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: Some({"iox::column::type": "iox::column_type::field::uinteger"}) } }, DFField { qualifier: Some("restaurant"), field: Field { name: "system", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: Some({"iox::column::type": "iox::column_type::field::float"}) } }, DFField { qualifier: Some("restaurant"), field: Field { name: "time", data_type: Timestamp(Nanosecond, None), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: Some({"iox::column::type": "iox::column_type::timestamp"}) } }, DFField { qualifier: Some("restaurant"), field: Field { name: "town", data_type: Dictionary(Int32, Utf8), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: Some({"iox::column::type": "iox::column_type::tag"}) } }], metadata: {} }")', query_tests/src/runner.rs:289:18
Expected behavior
The query should run successfully
Additional context
I also considered adding a config flag to turn off the check, but that seems worse than this less stringent test
Here is the PR where i am working to upgrade datafusion: https://github.com/influxdata/influxdb_iox/pull/6218#issuecomment-1325323048
Activity
alamb commentedon Nov 23, 2022
If you are curious, here is an example of the before/after schema: