You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/02/25 21:42:28 UTC

[GitHub] [calcite] 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)

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:
users@infra.apache.org


With regards,
Apache Git Services