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

bug: CAST(<array>) causes internal error #10464

Closed
NickCrews opened this issue May 12, 2024 · 3 comments · Fixed by #10474
Closed

bug: CAST(<array>) causes internal error #10464

NickCrews opened this issue May 12, 2024 · 3 comments · Fixed by #10474
Labels
bug Something isn't working

Comments

@NickCrews
Copy link

Describe the bug

The SQL SELECT CAST(MAKE_ARRAY(1, 2, 3) works just fine. But if you add a cast in there, eg
SELECT CAST(MAKE_ARRAY(1, 2, 3) AS VARCHAR[]) or SELECT CAST(MAKE_ARRAY() AS VARCHAR[]), then I get

E       Exception: Optimizer rule 'simplify_expressions' failed
E       caused by
E       simplify_expressions
E       caused by
E       Internal error: Failed due to a difference in schemas, original schema: DFSchema { fields: [DFField { qualifier: None, field: Field { name: "Cast(Array(Array), array<string>)", data_type: List(Field { name: "item", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} } }], metadata: {}, functional_dependencies: FunctionalDependencies { deps: [] } }, new schema: DFSchema { fields: [DFField { qualifier: None, field: Field { name: "Cast(Array(Array), array<string>)", data_type: List(Field { name: "field", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} } }], metadata: {}, functional_dependencies: FunctionalDependencies { deps: [] } }.
E       This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

Found in https://github.com/ibis-project/ibis/actions/runs/9042239055/job/24848519442?pr=8666 via ibis and the python bindings. datafusion.__version__ reveals 36.0.0

To Reproduce

No response

Expected behavior

No response

Additional context

No response

@NickCrews NickCrews added the bug Something isn't working label May 12, 2024
@alamb
Copy link
Contributor

alamb commented May 12, 2024

definitely looks like a bug -- thank you

@viirya
Copy link
Member

viirya commented May 12, 2024

I did a quick test using sqllogictest. The two queries are running okay with current main branch.

query ?
SELECT CAST(MAKE_ARRAY(1, 2, 3) AS VARCHAR[])
----
[1, 2, 3]


query ?
SELECT CAST(MAKE_ARRAY() AS VARCHAR[])
----
[]

Seems that the issue was fixed already. I opened #10474 to add these tests to prevent regression.

@NickCrews
Copy link
Author

Thank you! sounds good, that could very well be the case. I only tested on the version that came when I pip install ibis-framework[datafusion]ed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants