[
https://issues.apache.org/jira/browse/CALCITE-4980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17479588#comment-17479588
]
Julian Hyde commented on CALCITE-4980:
--------------------------------------
{quote}which SqlKind is used for operator of '<=>'.
I didn't find appropriate SqlKind, so I define it's SqlKind#OTHER_FUNCTION
Is it right?
{quote}
It's not essential that every operator has a distinct SqlKind. It's most useful
when applying rewrite rules. We really want '=' to have its own SqlKind, for
instance, because it appears in a lot of rewrite rules.
In this case, the '<=>' will have been converted to 'IS NOT DISTINCT FROM'
before rewrite rules kick in.
> Babel parser support MySQL NULL-safe equal operator '<=>'
> ---------------------------------------------------------
>
> Key: CALCITE-4980
> URL: https://issues.apache.org/jira/browse/CALCITE-4980
> Project: Calcite
> Issue Type: New Feature
> Components: babel, core
> Reporter: Xurenhe
> Assignee: Xurenhe
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> Babel parser support MySQL equal operator '<=>'.
> Mysql link:
> [https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#operator_equal-to]
>
> {code:java}
> // test case
> @Test void testParseEqual() {
> final String sql = "select '1' <=> '2' from t";
> final String expected = ""
> + "SELECT 1' <=> '2'\n"
> + "FROM `T`";
> sql(sql).ok(expected);
> } {code}
> {code:java}
> // exception stack
> java.lang.RuntimeException: Error while parsing SQL: select '1' <=> '2'
> from t
> at
> org.apache.calcite.sql.parser.SqlParserTest$TesterImpl.parseStmtAndHandleEx(SqlParserTest.java:9704)
> at
> org.apache.calcite.sql.parser.SqlParserTest$TesterImpl.check(SqlParserTest.java:9690)
> at
> org.apache.calcite.sql.parser.SqlParserTest$Sql.ok(SqlParserTest.java:10047)
> at
> org.apache.calcite.test.BabelParserTest.testParseEqual(BabelParserTest.java:246)
> Caused by: java.lang.RuntimeException:
> org.apache.calcite.sql.parser.SqlParseException: Encountered "<= >" at line
> 1, column 12.
> Was expecting one of: {code}
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)