[Feature][transform-v2] Fix SQL transform bugs and refactor tests #10145
+2,064
−1,502
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#10137
Purpose of this pull request
This pull request fixes several edge‑case bugs in the SQL transform functions (mainly numeric, string and date/time functions) and adds/updates SQL‑level tests such as SQLNumericFunctionsTest, SQLStringFunctionsTest and SQLSystemFunctionsTest to cover them. It also cleans up test comments to remove Chinese characters so that ChineseCharacterCheckTest and the CI checks can pass.
Does this PR introduce any user-facing change?
Yes.
Some date/time functions (for example month difference and week/day‑of‑week related functions) are corrected to follow the documented and common SQL semantics.
Numeric casting and SIGN behavior are adjusted (e.g. support for SHORT type, case‑insensitive type names, and SIGN(NULL) now returning NULL instead of 0).
String functions such as ASCII, LEFT and RIGHT now handle NULL, empty strings and negative/zero lengths more consistently (e.g. ASCII(NULL)/ASCII('') return NULL, LEFT/RIGHT with negative length return an empty string and over‑length counts return the whole string).
These are all bug fixes to existing SQL behavior; no new configuration or connector‑level behavior is introduced.
How was this patch tested?
Added and updated SQL‑level unit tests for numeric, string and system functions, including SQLNumericFunctionsTest, SQLStringFunctionsTest and SQLSystemFunctionsTest.
Verified the behavior locally by running module tests such as mvn -pl seatunnel-transforms-v2 -Dtest=SQL*FunctionsTest test and ensuring ChineseCharacterCheckTest passes after removing Chinese comments.
Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.