Skip to content

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 enhancement New feature or request labels Jul 30, 2021
unkloud pushed a commit to unkloud/datafusion that referenced this pull request Mar 23, 2025
* adding chr null test

* removing comments

* repro bug

* adding chr scalarfunc compatible with spark

* remove ANSI configs, as it is not needed for chr

* removing redundant test

* Update core/src/execution/datafusion/expressions/scalar_funcs/chr.rs

Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>

* adding support for scalar values

* fix clippy errs

* simplifying the scalar/array handling fn

* fix fmt errors

---------

Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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