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

[Feature][Transform] Sql transform support array and split function #8016

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

CosmosNi
Copy link
Contributor

selectItem support array and split func

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@Hisoka-X Hisoka-X changed the title [Feature][transform] selectItem support array and split func [Feature][Transform] Sql Transform support array and split function Nov 11, 2024
@Hisoka-X Hisoka-X changed the title [Feature][Transform] Sql Transform support array and split function [Feature][Transform] Sql transform support array and split function Nov 11, 2024
Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

LGTM if ci passes. Thanks @CosmosNi !

@@ -70,11 +68,13 @@ public static Object nullif(List<Object> args) {
return v1;
}

public static Object array(List<Object> args) {
public static String[] array(List<Object> args) {
Copy link
Member

@hailin0 hailin0 Nov 12, 2024

Choose a reason for hiding this comment

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

Why does it return a fixed string[]?

Example:
Array(1, 2, 3) returns Integer[]
Array(1L, 2, 3) returns Long[]
Array(1L, 1.1F, 2.1D) returns Double[]
Array(true, false, true) returns Boolean[]
Array(true, "aaa", 1) returns String[]
Array(1, true, 3L) returns String[]

Copy link
Member

@hailin0 hailin0 Nov 12, 2024

Choose a reason for hiding this comment

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

Of course, you can merge this pr and submit a new PR to optimize this function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

case ZetaSQLFunction.ARRAY:
return ArrayType.STRING_ARRAY_TYPE;

Then we need to dynamically generate the returned ArrayType.

Copy link
Member

Choose a reason for hiding this comment

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

Then we need to dynamically generate the returned ArrayType.

+1, we can reuse

public static boolean canConvert(SeaTunnelDataType<?> from, SeaTunnelDataType<?> to) {
to check and convert type.

@Hisoka-X Hisoka-X merged commit 21f7711 into apache:dev Nov 13, 2024
7 checks passed
eyys pushed a commit to eyys/seatunnel that referenced this pull request Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants