You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "walterddr (via GitHub)" <gi...@apache.org> on 2023/07/23 13:56:48 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #11151: [multistage] [bugfix] Derive SUM return type

walterddr commented on code in PR #11151:
URL: https://github.com/apache/pinot/pull/11151#discussion_r1271452691


##########
pinot-integration-tests/src/test/resources/tpch/22.sql:
##########
@@ -21,7 +21,7 @@ where
       )
       and ps_availqty > (
         select
-          0.5 * sum(l_quantity)
+          CAST(0.5 * SUM(l_quantity) AS DECIMAL(19, 1))

Review Comment:
   the problem with this is b/c the 0.5 has DECIMAL value and it is a Literal 
   this will cause Calcite to explicitly hoist the SUM results by a specific precision and scale. 
   
   no one will actually use this in practices, and i suggest we disable this test until further fix can be put in place?



##########
pinot-query-planner/src/test/resources/queries/JoinPlans.json:
##########
@@ -313,22 +313,78 @@
       },
       {
         "description": "Correlated join",
-        "sql": "EXPLAIN PLAN FOR SELECT a.col1 FROM a WHERE a.col4 > (SELECT 0.5 * SUM(b.col3) FROM b WHERE b.col2 = a.col2 AND b.col1 = a.col1)",
+        "sql": "EXPLAIN PLAN FOR SELECT a.col1 FROM a WHERE a.col4 > (SELECT CAST(0.5 * SUM(b.col3) AS DECIMAL(19, 1)) FROM b WHERE b.col2 = a.col2 AND b.col1 = a.col1)",

Review Comment:
   cast as double here and put a TODO?



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BaseClusterIntegrationTestSet.java:
##########
@@ -146,6 +146,9 @@ private void testHardcodedQueriesCommon()
     String query;
     String h2Query;
 
+    // SUM result will overflow INTEGER
+    query = "SELECT SUM(ActualElapsedTime) FROM mytable";

Review Comment:
   should at least add 4 tests for INT LONG(BIGINT) FLOAT(REAL) and DOUBLE



-- 
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-unsubscribe@pinot.apache.org

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


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