datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

Bug triggered by special aliases in nested queries

Open JasonLi-cn opened this issue 1 year ago • 0 comments

Describe the bug

SQL

SELECT "test.a" FROM (SELECT a AS "test.a" FROM test)

Bug

Error: Context("Optimizer rule 'optimize_projections' failed", Context("optimize_projections", Internal("Failed due to a difference in schemas, original schema: DFSchema { inner: Schema { fields: [Field { name: "test.a", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }, field_qualifiers: [None], functional_dependencies: FunctionalDependencies { deps: [] } }, new schema: DFSchema { inner: Schema { fields: [Field { name: "a", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }, field_qualifiers: [Some(Bare { table: "test" })], functional_dependencies: FunctionalDependencies { deps: [] } }")))

Other SQLs

SELECT "public.test.a" FROM (SELECT a AS "public.test.a" FROM public.test)
SELECT "datafusion.public.test.a" FROM (SELECT a AS "datafusion.public.test.a" FROM datafusion.public.test)

To Reproduce

No response

Expected behavior

Return success

Additional context

No response

JasonLi-cn avatar Aug 27 '24 01:08 JasonLi-cn