close
Skip to content

[Feature][SQL Transform] Check SQL Cast will fail or not during the SQL parsing stage#9600

Merged
Hisoka-X merged 13 commits into
apache:devfrom
liuwei178:dev
Jul 28, 2025
Merged

[Feature][SQL Transform] Check SQL Cast will fail or not during the SQL parsing stage#9600
Hisoka-X merged 13 commits into
apache:devfrom
liuwei178:dev

Conversation

@liuwei178

Copy link
Copy Markdown
Contributor
  • Removed unnecessary type conversion logic in SystemFunction
  • Added check on data type cast in ZetaSQLType.

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

- 移除了 SystemFunction 中不必要的类型转换逻辑
- 在 ZetaSQLType 中增加了对不同数据类型转换的限制
@Hisoka-X

Copy link
Copy Markdown
Member

Thanks @liuwei178 . Please follow the guide to open CI on your fork repository. https://github.com/apache/seatunnel/pull/9600/checks?check_run_id=46369080578

@Hisoka-X Hisoka-X left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add test case

@liuwei178

Copy link
Copy Markdown
Contributor Author

i added the test and enabled the CI. Please take some time to review them when you're available @Hisoka-X

@liuwei178

Copy link
Copy Markdown
Contributor Author
image image What should I do if some unmodified modules report a timeout during the CI phase?

@Hisoka-X

Copy link
Copy Markdown
Member

What should I do if some unmodified modules report a timeout during the CI phase?

Please retrigger the failed ci. Thanks

public static final String TIME = "TIME";
public static final String BOOLEAN = "BOOLEAN";

public static final List<SqlType> DATETIME_CAST_TYPES =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @liuwei178 . Can we refactor it and move the cast-related logic and validation rules into separate classes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll refactor it as soon as possible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Hisoka-X hi,Please help check which parts still need to adjust

liuwei178 and others added 4 commits July 23, 2025 09:43
-Added CastFunction class to handle type conversion operations
-Optimized type conversion logic to support more data type conversions
@github-actions github-actions Bot added the e2e label Jul 24, 2025
-add long type
@github-actions github-actions Bot removed the e2e label Jul 24, 2025

@Hisoka-X Hisoka-X left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks @liuwei178

return BasicType.STRING_TYPE;
case BYTE:
case TINYINT:
if (SqlType.TINYINT.equals(originType) || SqlType.STRING.equals(originType)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For validation types, are they referring to the types that we currently have the capability to convert?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, these are just some pre-validation steps added to our existing capabilities, for example, when converting Timestamp to SMALLINT is illegal. @Carl-Zhou-CN
Link to #9538

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok. Thank you for your answer

@Carl-Zhou-CN Carl-Zhou-CN left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@Hisoka-X Hisoka-X merged commit 044bd3c into apache:dev Jul 28, 2025
9 checks passed
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.

[Feature][SQL Transform] Check SQL Cast will fail or not during the SQL parsing stage

3 participants