feat: Add toPrestoTypeSql() for Presto SQL type formatting (#16876)#16876
Closed
mbasmanova wants to merge 1 commit intofacebookincubator:mainfrom
Closed
feat: Add toPrestoTypeSql() for Presto SQL type formatting (#16876)#16876mbasmanova wants to merge 1 commit intofacebookincubator:mainfrom
mbasmanova wants to merge 1 commit intofacebookincubator:mainfrom
Conversation
|
@mbasmanova has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97605331. |
✅ Deploy Preview for meta-velox canceled.
|
xiaoxmeng
approved these changes
Mar 21, 2026
…ncubator#16876) Summary: Move toTypeSql() from velox/exec/fuzzer/PrestoSql (test utility) to velox/functions/prestosql/types/PrestoTypeSql so it can be used from production code. Rename to toPrestoTypeSql() to clarify dialect. Fix a number of issues in the original implementation: - Custom types (IPPREFIX, BINGTILE) were expanded into their underlying ROW structure instead of using type->name(). Use typeid check to detect custom types implemented on top of ARRAY, MAP, or ROW. - Parameterized types (TDIGEST(DOUBLE), DECIMAL(10, 2)) were not handled. Use type->parameters() to format them generically. - ROW field names with spaces or special characters were not quoted. Use std::quoted() with Presto SQL double-quote escaping. - Unnamed ROW fields produced extra spaces. Also add VELOX_DECLARE_ENUM_NAME for TypeParameterKind. Needed for SHOW CREATE TABLE support in Axiom. Reviewed By: xiaoxmeng Differential Revision: D97605331
8d0f4e5 to
77fe34d
Compare
|
This pull request has been merged in cf9ee6b. |
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.
Summary:
Move toTypeSql() from velox/exec/fuzzer/PrestoSql (test utility) to
velox/functions/prestosql/types/PrestoTypeSql so it can be used from
production code. Rename to toPrestoTypeSql() to clarify dialect.
Fix a number of issues in the original implementation:
ROW structure instead of using type->name(). Use typeid check to
detect custom types implemented on top of ARRAY, MAP, or ROW.
handled. Use type->parameters() to format them generically.
Use std::quoted() with Presto SQL double-quote escaping.
Also add VELOX_DECLARE_ENUM_NAME for TypeParameterKind.
Needed for SHOW CREATE TABLE support in Axiom.
Reviewed By: xiaoxmeng
Differential Revision: D97605331