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

This is because a mutation step precedes the projection+filtering: #3144

Closed
kszucs opened this issue Dec 7, 2021 · 1 comment
Closed

This is because a mutation step precedes the projection+filtering: #3144

kszucs opened this issue Dec 7, 2021 · 1 comment

Comments

@kszucs
Copy link
Member

kszucs commented Dec 7, 2021

This is because a mutation step precedes the projection+filtering:

functional_alltypes = functional_alltypes.mutate(
    bool_col=t.bool_col == 1,
    timestamp_col=t.timestamp_col.cast('timestamp'),
)

Translated to datafusion level:

import datafusion as df

# bool_col is an integer here, convert it to be actually boolean
bool_col = (df.column("bool_col") == df.literal(1)).alias("bool_col")
result = table.select(bool_col).filter(df.column("bool_col"))
result.collect()

raises

Exception: Error during planning: Ambiguous reference to field named 'bool_col'

We could use LogicalPlanBuilder::project_with_alias() so ibis can assign and track unique qualifiers for ambiguous field names coming from subselects. Though this must be wired through all the way to PyDataFrame::select()

cc @houqp

Originally posted by @kszucs in #2918 (comment)

@kszucs
Copy link
Member Author

kszucs commented Dec 7, 2021

Wanted to create in the datafusion repository, closing.

@kszucs kszucs closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant