NobiGo commented on code in PR #4261:
URL: https://github.com/apache/calcite/pull/4261#discussion_r2011393506


##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -1364,6 +1364,47 @@ private static String toSql(RelNode root, SqlDialect 
dialect,
     sql(query).ok(expected);
   }
 
+  /**
+   * Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6909";>[CALCITE-6909]
+   * Support ClickHouse Dailect with Decimal type</a>.
+   */
+  @Test void testClickHouseCastDecimalPrecision() {
+    final String query = "select cast(\"product_id\" as decimal(8,2)) "
+        + "from \"product\" ";
+    final String query1 = "select cast(\"product_id\" as decimal(12,2)) "
+        + "from \"product\" ";
+    final String query2 = "select cast(\"product_id\" as decimal(22,2)) "
+        + "from \"product\" ";
+    final String query3 = "select cast(\"product_id\" as decimal(42,2)) "
+        + "from \"product\" ";
+
+    final String expectedClickHouse = "SELECT CAST(`product_id` AS 
`Decimal32(2)`)\n"

Review Comment:
   ```
   select cast(age as decimal(2,1)) from test1; --success 
   select cast(age as `Decimal32(2)`) from test1; -- failed.
   ```



-- 
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]

Reply via email to