You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2022/12/12 22:09:00 UTC
[pinot] branch master updated: [multistage][testing] Add test for null handling, round func and some other cases (#9950)
This is an automated email from the ASF dual-hosted git repository.
jackie 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 6a5f58b8e1 [multistage][testing] Add test for null handling, round func and some other cases (#9950)
6a5f58b8e1 is described below
commit 6a5f58b8e194bee7211bb9bdc97ad855486b296d
Author: Yao Liu <ya...@startree.ai>
AuthorDate: Mon Dec 12 14:08:54 2022 -0800
[multistage][testing] Add test for null handling, round func and some other cases (#9950)
---
.../src/test/resources/queries/Cast.json | 20 +++++++++
.../src/test/resources/queries/MathFuncs.json | 50 ++++++++++++++++++++++
.../src/test/resources/queries/NullHanlding.json | 40 +++++++++++++++++
.../test/resources/queries/TableExpressions.json | 2 +
4 files changed, 112 insertions(+)
diff --git a/pinot-query-runtime/src/test/resources/queries/Cast.json b/pinot-query-runtime/src/test/resources/queries/Cast.json
new file mode 100644
index 0000000000..f640148a48
--- /dev/null
+++ b/pinot-query-runtime/src/test/resources/queries/Cast.json
@@ -0,0 +1,20 @@
+{
+ "select_expression_test": {
+ "tables": {
+ "cast_as_int": {
+ "schema":[
+ {"name": "strCol", "type": "STRING"}
+ ],
+ "inputs": [
+ ["123"],
+ ["456"]
+ ]
+ }
+ },
+ "queries": [
+ {
+ "sql":"SELECT cast strCol as INT FROM {cast_as_int};"
+ }
+ ]
+ }
+}
diff --git a/pinot-query-runtime/src/test/resources/queries/MathFuncs.json b/pinot-query-runtime/src/test/resources/queries/MathFuncs.json
index 2a84c4b1d7..8915696b05 100644
--- a/pinot-query-runtime/src/test/resources/queries/MathFuncs.json
+++ b/pinot-query-runtime/src/test/resources/queries/MathFuncs.json
@@ -535,5 +535,55 @@
"sql": "SELECT longCol / 1e20 FROM {numTbl}"
}
]
+ },
+ "round": {
+ "tables": {
+ "numTbl": {
+ "schema": [
+ {"name": "intCol", "type": "INT"},
+ {"name": "longCol", "type": "LONG"},
+ {"name": "doubleCol", "type": "DOUBLE"},
+ {"name": "floatCol", "type": "FLOAT"}
+ ],
+ "inputs": [
+ [0, 3, 0.123, 3.2],
+ [123, 321, 4.242, 3.03],
+ [-456, -2, 1.134, 7.722],
+ [123, -456, 3.634, 9.12]
+ ]
+ }
+ },
+ "queries": [
+ {
+ "description": "test round on integer columns",
+ "ignored": true,
+ "comment": "we round the number up somehow",
+ "sql": "SELECT round(intCol, 2) FROM {numTbl}"
+ },
+ {
+ "description": "test round on long columns",
+ "ignored": true,
+ "comment": "we round the number up somehow",
+ "sql": "SELECT round(longCol, 2) FROM {numTbl}"
+ },
+ {
+ "description": "test round on double columns",
+ "ignored": true,
+ "comment": "double is rounded to 0",
+ "sql": "SELECT round(doubleCol, 2) FROM {numTbl}"
+ },
+ {
+ "description": "test ceil on float columns",
+ "ignored": true,
+ "comment": "float is rounded to 0",
+ "sql": "SELECT round(floatCol, 2) FROM {numTbl}"
+ },
+ {
+ "ignored": true,
+ "comment": "Caught exception while initializing transform function: round",
+ "description": "test round on literal",
+ "sql": "SELECT round(2.0, 0) FROM {numTbl}"
+ }
+ ]
}
}
diff --git a/pinot-query-runtime/src/test/resources/queries/NullHanlding.json b/pinot-query-runtime/src/test/resources/queries/NullHanlding.json
new file mode 100644
index 0000000000..d02234b8b0
--- /dev/null
+++ b/pinot-query-runtime/src/test/resources/queries/NullHanlding.json
@@ -0,0 +1,40 @@
+{
+ "select_expression_test": {
+ "tables": {
+ "null_handling": {
+ "schema":[
+ {"name": "a", "type": "INT"},
+ {"name": "b", "type": "INT"},
+ {"name": "c", "type": "STRING"},
+ {"name": "d", "type": "BOOLEAN"}
+ ],
+ "inputs": [
+ [0, 1, null, true],
+ [1, 2, "AAAA", false],
+ [2, null, "AAAA", true],
+ [3, 3, "BBBB", false],
+ [4, 3, null, true],
+ [null, 3, "bbbb", false],
+ [6, 4, "cccc", null],
+ [null, null, null, null],
+ [null, 4, "CCCC", null],
+ [9, 4, "CCCC", true]
+ ]
+ }
+ },
+ "queries": [
+ {
+ "sql":"SELECT is_null(a), is_null(b), is_null(c), is_null(d) FROM {null_handling};"
+ },
+ {
+ "sql":"SELECT is_not_null(a), is_not_null(b), is_not_null(c), is_not_null(d) FROM {null_handling};"
+ },
+ {
+ "sql":"SELECT is_null(null), is_not_null(null) FROM {null_handling};"
+ },
+ {
+ "sql":"SELECT is_null('a'), is_not_null('b') FROM {null_handling};"
+ }
+ ]
+ }
+}
diff --git a/pinot-query-runtime/src/test/resources/queries/TableExpressions.json b/pinot-query-runtime/src/test/resources/queries/TableExpressions.json
index a722a7bd93..a25970901d 100644
--- a/pinot-query-runtime/src/test/resources/queries/TableExpressions.json
+++ b/pinot-query-runtime/src/test/resources/queries/TableExpressions.json
@@ -17,8 +17,10 @@
},
"queries": [
{ "sql": "SELECT * FROM {tbl} WHERE intCol > 5" },
+ { "sql": "SELECT * FROM {tbl} WHERE strCol = 'foo'" },
{ "sql": "SELECT * FROM {tbl} WHERE strCol IN ('foo', 'bar')" },
{ "sql": "SELECT * FROM {tbl} WHERE intCol IN (196883, 42)" },
+ { "sql": "SELECT * FROM {tbl} WHERE intCol IN (111, 222)" },
{ "sql": "SELECT * FROM {tbl} WHERE intCol NOT IN (196883, 42) AND strCol IN ('alice')" },
{ "sql": "SELECT * FROM {tbl} WHERE strCol IN (SELECT strCol FROM {tbl} WHERE intCol > 100)" },
{ "sql": "SELECT * FROM {tbl} WHERE intCol < (SELECT SUM(intCol) FROM {tbl} AS b WHERE strCol BETWEEN 'bar' AND 'foo')" },
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org