You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by si...@apache.org on 2022/07/18 19:04:23 UTC
[pinot] branch master updated: [multistage] add more query types for testing (#9068)
This is an automated email from the ASF dual-hosted git repository.
siddteotia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 9176db4c71 [multistage] add more query types for testing (#9068)
9176db4c71 is described below
commit 9176db4c71e784ff679914160e375a1e1e7a43d4
Author: Rong Rong <wa...@gmail.com>
AuthorDate: Mon Jul 18 12:04:17 2022 -0700
[multistage] add more query types for testing (#9068)
* function on JOIN key
* adding sub-query test
Co-authored-by: Rong Rong <ro...@startree.ai>
---
.../org/apache/pinot/query/QueryEnvironmentTestBase.java | 4 ++++
.../java/org/apache/pinot/query/runtime/QueryRunnerTest.java | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestBase.java b/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestBase.java
index 1c6ad7ff29..a146f5ca3d 100644
--- a/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestBase.java
+++ b/pinot-query-planner/src/test/java/org/apache/pinot/query/QueryEnvironmentTestBase.java
@@ -56,6 +56,10 @@ public class QueryEnvironmentTestBase {
+ " GROUP BY a.col1, a.col2"},
new Object[]{"SELECT a.col1, AVG(b.col3) FROM a JOIN b ON a.col1 = b.col2 "
+ " WHERE a.col3 >= 0 AND a.col2 = 'a' AND b.col3 < 0 GROUP BY a.col1"},
+ new Object[]{"SELECT a.col1, a.col3, b.col3 FROM a JOIN b ON MOD(a.col3, 2) = MOD(b.col3, 2)"},
+ new Object[]{"SELECT a.col1, a.col3, i.maxVal FROM a JOIN "
+ + " (SELECT b.col1 AS joinKey, MAX(b.col3) AS maxVal FROM b GROUP BY b.col1) AS i "
+ + " ON a.col1 = i.joinKey"},
};
}
}
diff --git a/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java b/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java
index abf3b2a89d..1142210de8 100644
--- a/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java
+++ b/pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTest.java
@@ -159,9 +159,10 @@ public class QueryRunnerTest {
// thus the final JOIN result will be 15 x 1 = 15.
new Object[]{"SELECT * FROM a JOIN b on a.col1 = b.col1", 15},
- // Specifically table A has 15 rows (10 on server1 and 5 on server2) and table B has 5 rows (all on server1),
- // thus the final JOIN result will be 15 x 1 = 15.
- new Object[]{"SELECT * FROM a JOIN b on a.col1 = b.col1 AND a.col2 = b.col2", 15},
+ // Query with function in JOIN keys, table A and B are both (1, 2, 42, 1, 2), with table A cycling 3 times.
+ // Final result would have 6 x 2 = 12 (6 (1)s on with MOD result 1, on both tables)
+ // + 9 x 1 = 9 (6 (2)s & 3 (42)s on table A MOD 2 = 0, 1 (42)s on table B MOD 3 = 0): 21 rows in total.
+ new Object[]{"SELECT a.col1, a.col3, b.col3 FROM a JOIN b ON MOD(a.col3, 2) = MOD(b.col3, 3)", 21},
// Specifically table A has 15 rows (10 on server1 and 5 on server2) and table B has 5 rows (all on server1),
// thus the final JOIN result will be 15 x 1 = 15.
@@ -206,6 +207,11 @@ public class QueryRunnerTest {
// only 3 GROUP BY key exist because b.col2 cycles between "foo", "bar", "alice".
new Object[]{"SELECT a.col1, SUM(b.col3) FROM a JOIN b ON a.col1 = b.col2 "
+ " WHERE a.col3 >= 0 GROUP BY a.col1", 3},
+
+ // Sub-query
+ new Object[]{"SELECT b.col1, b.col3, i.maxVal FROM b JOIN "
+ + " (SELECT a.col2 AS joinKey, MAX(a.col3) AS maxVal FROM a GROUP BY a.col2) AS i "
+ + " ON b.col1 = i.joinKey", 3}
};
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org