Handle the sql type named LONG as an alias for BIGINT #18789
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