amaliujia commented on a change in pull request #1437: [CALCITE-3318] 
Preserving CAST of STRING operands in comparison operator
URL: https://github.com/apache/calcite/pull/1437#discussion_r337643171
 
 

 ##########
 File path: 
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
 ##########
 @@ -3854,6 +3854,24 @@ private void checkLiteral2(String expression, String 
expected) {
     sql(expected).exec();
   }
 
+  @Test public void testCastInStringOperandOfComparison() {
+    final String query = "select \"employee_id\" "
+        + "from \"foodmart\".\"employee\" "
+        + "where 10 = cast('10' as int) and \"birth_date\" = cast('1914-02-02' 
as date) or "
+        + "\"hire_date\" = cast('1996-01-01 '||'00:00:00' as timestamp)";
+    final String expected = "SELECT \"employee_id\"\n"
+        + "FROM \"foodmart\".\"employee\"\n"
+        + "WHERE 10 = '10' AND \"birth_date\" = '1914-02-02' OR \"hire_date\" 
= '1996-01-01 ' || "
+        + "'00:00:00'";
+    final String expectedBiqquery = "SELECT employee_id\n"
+        + "FROM foodmart.employee\n"
+        + "WHERE 10 = CAST('10' AS INTEGER) AND birth_date = '1914-02-02' OR 
hire_date = "
 
 Review comment:
   I see. I will send an email to discuss how to handle unsupported type for 
BigQuery and then send a patch.
   
   Basically I will ask if people like to throw an exception directly or does a 
cast if that's compatible.

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