[Feature](nereids) Add Snowflake dialect compatibility - Phase 1 & 2 Pure Alias Registration && FE Expression Rewrite#60982
Open
kaori-seasons wants to merge 1 commit intoapache:masterfrom
Open
Conversation
Implement Snowflake SQL dialect compatibility to improve direct execution coverage on Apache Doris from ~40% to ~85%. Phase 1 - Pure Alias Registration (16 aliases): - IFF -> If, ARRAY_CONSTRUCT -> Array, ARRAY_CAT -> ArrayConcat - ARRAY_TO_STRING -> ArrayJoin, PARSE_JSON -> JsonbParse - TRY_PARSE_JSON -> JsonbParseErrorToNull, CHECK_JSON -> JsonbValid - BASE64_ENCODE -> ToBase64, BASE64_DECODE_STRING -> FromBase64 - HEX_ENCODE -> Hex, HEX_DECODE_STRING -> Unhex - ENDSWITH -> EndsWith, STARTSWITH -> StartsWith - GETDATE -> Now, LEN -> CharacterLength, CHARINDEX -> Locate - Fix: Merge duplicate JsonbValid registrations into single line Phase 2 - FE Expression Rewrite Functions (7 new classes): - ZEROIFNULL(x) -> Coalesce(x, Cast(0, x.type)) - NULLIFZERO(x) -> NullIf(x, Cast(0, x.type)) - NVL2(e1, e2, e3) -> If(Not(IsNull(e1)), e2, e3) - EQUAL_NULL(a, b) -> NullSafeEqual(a, b) - CONVERT_TIMEZONE(src, dst, ts) -> ConvertTz(ts, src, dst) - OBJECT_CONSTRUCT(k1, v1, ...) -> JsonObject(k1, v1, ...) - TO_VARCHAR(expr[, fmt]) -> Cast(expr, VARCHAR) or DateFormat(expr, fmt) All 7 functions registered in BuiltinScalarFunctions and ScalarFunctionVisitor. Tests: - 32 FE unit tests (SnowflakeCompatFunctionTest) covering all aliases and rewrite functions with constant and column-based scenarios - 2 regression test suites (test_snowflake_aliases.groovy, test_snowflake_rewrite.groovy) for end-to-end validation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Author
Hello, thank you for your reply. I have linked an issue related to this PR. This issue was created based on the roadmap released by the community this year, which supports the migration from Snowflake to Doris. The main target audience is some overseas users who face this need. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to issue-60951
Implement Snowflake SQL dialect compatibility to improve direct execution coverage on Apache Doris from ~40% to ~85%.
Phase 1 - Pure Alias Registration (16 aliases):
Phase 2 - FE Expression Rewrite Functions (7 new classes):
All 7 functions registered in BuiltinScalarFunctions and ScalarFunctionVisitor.
Tests:
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)