Handle the sql type named LONG as an alias for BIGINT#18789
Closed
zhan7236 wants to merge 2 commits into
Closed
Conversation
This change allows users to write CAST(x AS LONG) in SQL queries, which is treated as equivalent to CAST(x AS BIGINT). This is useful for users migrating from the native engine who are accustomed to working with LONG types. Changes: - Add LONG keyword to the parser configuration - Modify SqlTypeName1 rule to accept LONG as an alias for BIGINT - Add test case to verify CAST AS LONG works correctly Fixes apache#17425
a26fd53 to
93486d2
Compare
|
This pull request has been marked as stale due to 60 days of inactivity. |
|
This pull request/issue has been closed due to lack of activity. If you think that |
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.
Description
This PR adds support for using
LONGas an alias forBIGINTin SQL CAST expressions. Users who are familiar with Druid's native engine often useLONGas a type name, but the SQL parser previously did not recognize it, resulting in an error.After this change, the following SQL will work correctly:
This is equivalent to:
Motivation
People using the native engine may write
CAST(some AS LONG)because they are accustomed to working with those types. However, the SQL parser didn't know that type and returned an error. This change handlesLONGas an alias toBIGINTfor better user experience.Fixes #17425
Changes
LONGto the keywords list.SqlTypeName1rule to acceptLONGas an alias forBIGINT(similar to howINTis an alias forINTEGER).testCastAsLongAliasBigint()to verify the new functionality.Testing
testCastAsLongAliasBigint()that verifiesCAST(dim1 AS LONG) = 2produces the same query plan asCAST(dim1 AS BIGINT) = 2.Checklist