ILuffZhe commented on code in PR #4445:
URL: https://github.com/apache/calcite/pull/4445#discussion_r2182100120
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -3564,6 +3564,24 @@ private SqlDialect nonOrdinalDialect() {
.withDoris().ok(expectedStarRocks);
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-7069">[CALCITE-7069]
+ * Invalid unparse for INT UNSIGNED and BIGINT UNSIGNED in
MysqlSqlDialect</a>. */
+ @Test void testCastToUnsignedInMySQL() {
+ final String query1 = "select cast(\"product_id\" as bigint unsigned) from
\"product\"";
+ // MySQL does not allow cast to BIGINT UNSIGNED; instead cast to UNSIGNED.
+ final String expectedMysql1 = "SELECT CAST(`product_id` AS UNSIGNED)\n"
+ + "FROM `foodmart`.`product`";
+ final String query2 = "select cast(\"product_id\" as integer unsigned)
from \"product\"";
+ // MySQL does not allow cast to INTEGER UNSIGNED; instead cast to UNSIGNED.
Review Comment:
I don't follow, since MySQL supports this, should we throw an exception here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]