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

Implement constant folding for CAST #513

Merged
merged 1 commit into from Jun 5, 2021

Conversation

msathis
Copy link
Contributor

@msathis msathis commented Jun 5, 2021

Which issue does this PR close?

Closes #417.

Rationale for this change

Optimize cast function during planning stage

What changes are included in this PR?

Optimize cast function during planning stage

Are there any user-facing changes?

N/A

data_type,
} => match inner.as_ref() {
Expr::Literal(val) => {
let scalar_array = val.to_array();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea👍 I think converting to an array is the best we can do for now, without duplicating the code.

Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is looking superb! Thanks @msathis

@jorgecarleitao jorgecarleitao merged commit b84789a into apache:master Jun 5, 2021
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @msathis !

.build()
.unwrap();

let expected = "Projection: Int32(0)\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is beautiful ❤️ -- thank you @msathis

.build()
.unwrap();

let expected = "Projection: Int32(NULL)\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@houqp houqp added datafusion Changes in the datafusion crate enhancement New feature or request labels Jul 30, 2021
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 this pull request may close these issues.

Implement constant folding for CAST
5 participants