xuzifu666 commented on code in PR #4287:
URL: https://github.com/apache/calcite/pull/4287#discussion_r2036401919


##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -9474,6 +9473,40 @@ private void checkLiteral2(String expression, String 
expected) {
     sql(sql).ok(expected);
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6940";>[CALCITE-6940]
+   * Hive/Phoenix Dialect should not cast to REAL type directly</a>. */
+  @Test void testRealTypesCast() {
+    String query = "SELECT CAST(\"department_id\" AS float), "
+        + "CAST(\"department_id\" AS double), "
+        + "CAST(\"department_id\" AS real) FROM \"employee\"";
+    String expectedPhoenix = "SELECT CAST(\"department_id\" AS FLOAT), "
+        + "CAST(\"department_id\" AS DOUBLE), "
+        + "CAST(\"department_id\" AS FLOAT)\nFROM \"foodmart\".\"employee\"";
+    String expectedHive = "SELECT CAST(`department_id` AS FLOAT), "
+        + "CAST(`department_id` AS DOUBLE), "
+        + "CAST(`department_id` AS FLOAT)\nFROM `foodmart`.`employee`";
+
+    sql(query)
+        .withPhoenix().ok(expectedPhoenix)
+        .withHive().ok(expectedHive);
+  }
+
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6940";>[CALCITE-6940]
+   * Hive/Phoenix Dialect should not cast to REAL type directly</a>. */
+  @Test void testRealArrayOrMapTypesCast() {
+    String query = "SELECT CAST(array[1,2,3] AS real array) FROM \"employee\"";
+    sql(query)
+        .withPhoenix().throws_("Phoenix dialect can not support cast to ARRAY")

Review Comment:
   Thanks, done.



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