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

API to get Expr's type and nullability without a DFSchema #1725

Closed
alamb opened this issue Feb 1, 2022 · 0 comments · Fixed by #1726
Closed

API to get Expr's type and nullability without a DFSchema #1725

alamb opened this issue Feb 1, 2022 · 0 comments · Fixed by #1726
Labels
datafusion Changes in the datafusion crate enhancement New feature or request

Comments

@alamb
Copy link
Contributor

alamb commented Feb 1, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I am trying to implement (fast) expression simplification that sits on the critical IOx query path (as the predicates get simplified and then used to prune out chunks based on catalog statistics)

When i created a PR to use the API proposed in #1717 for simplify exprs, I found out that to get is_boolean_type() and nullable information from an Expr I needed to pass it a DFSchema (which is a kind of wrapper over a normal Arrow Schema). For us in IOx this involves a copy (as we have our own wrapper over Schema).

Describe the solution you'd like
I would like to be able to use expression simplification without creating a new DFSchema.

Specifically

  1. Add a trait that can provide the needed information for schema quries to Expr
  2. Change the functions on Expr that take a &DFSchema such as Expr::nullable to be nullable
  3. impl this new trait for DFSchema so that existing callsites work

Describe alternatives you've considered
N/A

Additional context
You can see the code here: https://github.com/influxdata/influxdb_iox/pull/3588/files#r796004295

@alamb alamb added the enhancement New feature or request label Feb 1, 2022
@alamb alamb added the datafusion Changes in the datafusion crate label Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant