Skip to content

[Feature][SQL function] Enhance SQL Transform COALESCE functions to support type cast #9295

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

Open
2 of 9 tasks
hailin0 opened this issue May 8, 2025 · 3 comments · May be fixed by #9299
Open
2 of 9 tasks

[Feature][SQL function] Enhance SQL Transform COALESCE functions to support type cast #9295

hailin0 opened this issue May 8, 2025 · 3 comments · May be fixed by #9299
Assignees
Labels

Comments

@hailin0
Copy link
Member

hailin0 commented May 8, 2025

Search before asking

  • I had searched in the feature and found no similar feature requirement.

Description

Currently, in the SQL conversion of SeaTunnel, the COALESCE(args0, args1, args2, ...) function does not support casting args1 or args2 to the type of args0.

For example, args0 is of string type, args1 is of int type, and args2 is of double type, which will cause the wrong data type to be passed to the downstream. We should cast the data to the type indicated by args0(string).

Current Behavior

When trying to use COALESCE function directly on a string field:

SELECT COALESCE(str_field, 1) FROM my_table

Will output data type 1 <-> int

Expected Behavior

The COALESCE function should automatically handle type conversion, converting any other type to args0 type output

Changes

Usage Scenario

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@stupidly-logical
Copy link

Hi, I'd like to take this up.

@ocean-zhc
Copy link
Contributor

I have completed it, please assign it to me, it is currently in the testing stage

@hailin0 @davidzollo

@hailin0
Copy link
Member Author

hailin0 commented May 9, 2025

Hi, I'd like to take this up.

@stupidly-logical
If you are interested you can try other issues
https://github.com/apache/seatunnel/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
4 participants