julianhyde commented on a change in pull request #1828: [CALCITE-3734] MySQL 
JDBC rewrite is producing queries with CHAR with range beyond 255 (Vineet Garg)
URL: https://github.com/apache/calcite/pull/1828#discussion_r384143551
 
 

 ##########
 File path: 
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
 ##########
 @@ -1712,6 +1712,22 @@ private static String toSql(RelNode root, SqlDialect 
dialect) {
     sql(query).dialect(MysqlSqlDialect.DEFAULT).ok(expected);
   }
 
+  @Test public void testMySqlCastToVarcharWithLessThanMaxPrecision() {
+    final String query = "select cast(\"product_id\" as varchar(50)), 
\"product_id\" "
+        + "from \"product\" ";
+    final String expected = "SELECT CAST(`product_id` AS CHAR(50)), 
`product_id`\n"
+        + "FROM `foodmart`.`product`";
+    sql(query).dialect(mySqlDialect(NullCollation.HIGH)).ok(expected);
 
 Review comment:
   Rather than `.dialect(mySqlDialect(NullCollation.HIGH))`, is `withMysql()` 
sufficient?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to