[CALCITE-6055] Customize handling of type name based on type system#3476
Draft
wnob wants to merge 1 commit intoapache:mainfrom
Draft
[CALCITE-6055] Customize handling of type name based on type system#3476wnob wants to merge 1 commit intoapache:mainfrom
wnob wants to merge 1 commit intoapache:mainfrom
Conversation
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |
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.
Outline of the approach:
TIMESTAMP,TIMESTAMP WITH LOCAL TIME ZONE, andDATETIMEtype names as user-defined types during parsing.SqlUnknownLiteralworks. This is important so theTIMESTAMPandTIMESTAMP WITH LOCAL TIME ZONEtypes can still function when there is no UDT mapping for them.There's still a lingering problem in how to unparse the
SqlUserDefinedTypeNameSpecnodes. This is only relevant when aSqlNodeAST is parsed and then unparsed without converting toRelNodeform in between. I describe why I don't think this is a particularly important use-case in this Jira comment, but it's how theSqlParserTestand it's various subclasses operate. Looking for feedback on how to better address this:unparse()in a way similar toderiveType(): look up the UDT mapping and fall back on the standard types, thus preserving the existing default unparsing behavior forTIMESTAMP. However, this would require passing aSqlValidatortounparse(), which doesn't make a ton a sense.SqlTypeName, soTIMESTAMPunparsing is unaffected by default. However, this would mess up unparsing a dialect like BigQuery, since BigQuery timestamps would unparse asTIMESTAMP WITH LOCAL TIME ZONE, and datetimes would unparse as`DATETIME`(with backticks).There are myriad details that could be tweaked in either case, and possibly other approached I'm not thinking of yet.