Jackie-Jiang commented on code in PR #13650:
URL: https://github.com/apache/pinot/pull/13650#discussion_r1736923065


##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java:
##########
@@ -1143,9 +1150,17 @@ public void testFunctionWithLiteral(boolean 
useMultiStageQueryEngine)
 
     testQuery("SELECT SUM(10) FROM mytable");
     testQuery("SELECT ArrDelay + 10 FROM mytable");
-    testQuery("SELECT ArrDelay + '10' FROM mytable");
+    if (useMultiStageQueryEngine) {
+      testQuery("SELECT ArrDelay + CAST('10' as INT) FROM mytable");
+    } else {
+      testQuery("SELECT ArrDelay + '10' FROM mytable");

Review Comment:
   I tried this query and it does work in Postgres



##########
pinot-query-planner/src/test/java/org/apache/pinot/query/validate/PinotTypeCoercionImplTest.java:
##########
@@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.query.validate;
+
+import org.apache.pinot.query.QueryEnvironmentTestBase;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+public class PinotTypeCoercionImplTest extends QueryEnvironmentTestBase {
+
+  @DataProvider(name = "implicitCastCharToIntInWhere")
+  protected Object[][] provideQueriesWithWhere() {
+    return new Object[][]{
+        // VARCHAR BINARY_COMPARISON INTEGER
+        new Object[]{"SELECT * FROM a where col1 > 5"},
+        new Object[]{"SELECT * FROM a where col1 >= 5"},
+        new Object[]{"SELECT * FROM a where col1 < 5"},
+        new Object[]{"SELECT * FROM a where col1 <= 5"},
+        new Object[]{"SELECT * FROM a where col1 = 5"},
+        new Object[]{"SELECT * FROM a where col1 != 5"},
+
+
+        // INTEGER BINARY_COMPARISON VARCHAR
+        new Object[]{"SELECT * FROM a where 5 > col1"},
+        new Object[]{"SELECT * FROM a where 5 >= col1"},
+        new Object[]{"SELECT * FROM a where 5 < col1"},
+        new Object[]{"SELECT * FROM a where 5 <= col1"},
+        new Object[]{"SELECT * FROM a where 5 = col1"},
+        new Object[]{"SELECT * FROM a where 5 != col1"},
+
+        // (VARCHAR ARITHMETIC_OP INTEGER)
+        new Object[]{"SELECT * FROM a where col1 + 1 > 5"},
+        new Object[]{"SELECT * FROM a where col1 - 1 > 5"},
+        new Object[]{"SELECT * FROM a where col1 * 1 > 5"},
+        new Object[]{"SELECT * FROM a where col1 / 1 > 5"},
+
+        // (INTEGER ARITHMETIC_OP VARCHAR)
+        new Object[]{"SELECT * FROM a where 5 > col1 + 1"},
+        new Object[]{"SELECT * FROM a where 5 > col1 - 1"},
+        new Object[]{"SELECT * FROM a where 5 > col1 * 1"},
+        new Object[]{"SELECT * FROM a where 5 > col1 / 1"},
+
+        // Constants
+        new Object[]{"SELECT * FROM a where '10' > 5"},

Review Comment:
   This query also works in Postgres



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BaseClusterIntegrationTestSet.java:
##########
@@ -517,7 +517,11 @@ public void testQueryExceptions()
         useMultiStageQueryEngine()
             ? QueryException.QUERY_PLANNING_ERROR_CODE : 
QueryException.QUERY_EXECUTION_ERROR_CODE);
 
-    testQueryException("SELECT COUNT(*) FROM mytable where ArrTime = 'potato'",
+    // Implicit cast VARCHAR to INT is disabled in V2. So test them separately.
+    String queryV1 = "SELECT COUNT(*) FROM mytable where ArrTime = 'potato'";

Review Comment:
   `SELECT COUNT(*) FROM mytable where ArrTime = '10'` works in Postgres



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to