Skip to content

[CALCITE-4471] Support ignoring SYMMETRIC/ASYMMETRIC flag for between unparse#4817

Draft
wForget wants to merge 4 commits intoapache:mainfrom
wForget:CALCITE-4471
Draft

[CALCITE-4471] Support ignoring SYMMETRIC/ASYMMETRIC flag for between unparse#4817
wForget wants to merge 4 commits intoapache:mainfrom
wForget:CALCITE-4471

Conversation

@wForget
Copy link
Member

@wForget wForget commented Mar 2, 2026

Thanks to @hannerwang for his work on #2328, which I wanted to take over since it hadn't been active for a long time. I also tagged @hannerwang as an author in the first commit. Fix CALCITE-4471 and CALCITE-5279

Spark/Hive/Starrocks do not support the "SYMMETRIC/ASYMMETRIC" between flags.

Additionally, since Firebolt is not open source and I couldn't find the Firebolt SQL syntax definition file to determine if it applies to this change, I didn't change FireboltSqlDialect.

hannerwang and others added 3 commits March 2, 2026 13:38
…ASYMMETRIC" or "SYMMETRIC" flag

Signed-off-by: wforget <643348094@qq.com>
Signed-off-by: wforget <643348094@qq.com>
…m this change is correct)

Signed-off-by: wforget <643348094@qq.com>
Signed-off-by: wforget <643348094@qq.com>
@wForget
Copy link
Member Author

wForget commented Mar 2, 2026

@julianhyde Could you please take a look?

@wForget wForget changed the title [CALCITE-4471] Support ignoring "SYMMETRIC/ASYMMETRIC" flag for between unparse [CALCITE-4471] Support ignoring SYMMETRIC/ASYMMETRIC flag for between unparse Mar 2, 2026
call.operand(VALUE_OPERAND).unparse(writer, getLeftPrec(), 0);
writer.sep(super.getName());
writer.sep(flag.name());
if (writer.getDialect().supportsSQL99Between()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There were some comments on the issue about SYMMETRIC that needs to output an OR of two BETWEEN conditions. Where does this happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for pointing that out — I missed that comment. It seems we're doing this conversion in toRel

. Do we still need to do the same in unparse? Perhaps we could simply throw an exception here for unsupported SYMMETRIC calls. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

If the conversion was done in the convertlet table, you will never see this operator in your conversion, so there is nothing to do. You are handling the case when the conversion was not made.

Copy link
Member Author

Choose a reason for hiding this comment

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

If the conversion was done in the convertlet table, you will never see this operator in your conversion, so there is nothing to do. You are handling the case when the conversion was not made.

Makes sense

@wForget wForget marked this pull request as draft March 3, 2026 03:32
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