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

Adds cast function to DataType/ConcreteDataType #2376

Closed
killme2008 opened this issue Sep 13, 2023 · 1 comment · Fixed by #2394
Closed

Adds cast function to DataType/ConcreteDataType #2376

killme2008 opened this issue Sep 13, 2023 · 1 comment · Fixed by #2394
Assignees
Labels
C-enhancement Category Enhancements
Milestone

Comments

@killme2008
Copy link
Contributor

What type of enhancement is this?

API improvement

What does the enhancement do?

We need a function to cast a Value into the specific data type just like:

let  n= Value::Int64(1694589525);

// cast int64 into TimestampSecondType
let ts = ConcreteDataType::Timestamp(TimestampType::TimestampSecondType).cast(n).unwrap();

The signature of cast may be:

fn cast(value: Value) -> Option<Value>;

If the value can't be cast into the datatype, return None.

Implementation challenges

No response

@killme2008 killme2008 added the C-enhancement Category Enhancements label Sep 13, 2023
@QuenKar
Copy link
Contributor

QuenKar commented Sep 13, 2023

I will add cast function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants