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

The filters expressions in TableScan may contain fields not included in schema. #4793

Closed
HaoYang670 opened this issue Jan 2, 2023 · 2 comments · Fixed by #5188
Closed

The filters expressions in TableScan may contain fields not included in schema. #4793

HaoYang670 opened this issue Jan 2, 2023 · 2 comments · Fixed by #5188
Assignees
Labels
bug Something isn't working

Comments

@HaoYang670
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.
https://github.com/apache/arrow-datafusion/blob/54ae4323a730a4a34c6b5f638e2083f0c3fe5dcc/datafusion/expr/src/logical_plan/plan.rs#L1396-L1409

The Exprs in filter may contain fields which are not included in schema. This can cause the logical optimizer failing.

To Reproduce
Set skip_failing_rules to false, and run the test filter_pushdown_view.
The logical optimizer will fail and the error message says:

SchemaError(FieldNotFound { field: Column { relation: Some("t1"), name: "id" }, valid_fields: Some([Column { relation: Some("t1"), name: "bool_col" }, Column { relation: Some("t1"), name: "int_col" }]) })', datafusion/optimizer/src/unwrap_cast_in_comparison.rs:106:42

The failure is caused by that the schema of TableScan doesn't include the fields in filters:

TableScan: t1 projection=[bool_col, int_col], full_filters=[t1.id = Int32(1)]

Expected behavior
The optimizer should not fail.

Additional context
Add any other context about the problem here.

@HaoYang670 HaoYang670 added the bug Something isn't working label Jan 2, 2023
@HaoYang670
Copy link
Contributor Author

Could you please take a look @jackwener ?

@jackwener
Copy link
Member

I will try to fix it

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.

2 participants