Skip to content

[CALCITE-7768] SqlDialect has no way to unparse a UUID literal - #5250

Open
wasabii wants to merge 1 commit into
apache:mainfrom
wasabii:calcite-7768-uuid-literal-dialect
Open

[CALCITE-7768] SqlDialect has no way to unparse a UUID literal#5250
wasabii wants to merge 1 commit into
apache:mainfrom
wasabii:calcite-7768-uuid-literal-dialect

Conversation

@wasabii

@wasabii wasabii commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Jira Link

CALCITE-7768

Changes Proposed

A dialect can now decide how a UUID literal is written. The default output is unchanged, so only MSSQL is affected: it writes a plain quoted string, which SQL Server accepts.


public void unparseUuidLiteral(SqlWriter writer,
SqlUuidLiteral literal, int leftPrec, int rightPrec) {
writer.literal(literal.toString());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this default implementation align with MySQL or PostgreSQL? Should we choose a generic approach, or simply throw an error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not aware of any real database that uses the Calcite syntax. So the default is kinda useless. But that is the Calcite syntax.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for this default Calcite method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already is one I believe. Was there before me.

Comment thread core/src/main/java/org/apache/calcite/sql/SqlDialect.java
@wasabii
wasabii force-pushed the calcite-7768-uuid-literal-dialect branch from afea2ad to 67ded76 Compare September 11, 2026 07:30
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants