gortiz commented on code in PR #11824:
URL: https://github.com/apache/pinot/pull/11824#discussion_r1373365094
##########
pinot-query-runtime/src/test/resources/queries/NullHandling.json:
##########
@@ -66,5 +66,230 @@
"keepOutputRowOrder": true
}
]
+ },
+ "nullable_columns": {
+ "tables": {
+ "tbl1" : {
+ "schema": [
+ {"name": "strCol1", "type": "STRING"},
+ {"name": "intCol1", "type": "INT"},
+ {"name": "nIntCol1", "type": "INT", "nullable": true},
+ {"name": "nnIntCol1", "type": "INT", "nullable": false},
+ {"name": "strCol2", "type": "STRING"},
+ {"name": "nStrCol2", "type": "STRING", "nullable": true},
+ {"name": "nnStrCol2", "type": "STRING", "nullable": false}
+ ],
+ "inputs": [
+ ["foo", 1, 1, 1, "foo", "foo", "foo"],
+ ["bar", 2, 2, 2, "alice", "alice", "alice"],
+ ["alice", 2, 2, 2, null, null, null],
+ [null, 4, 4, 4, null, null, null],
+ ["bob", null, null, null, null, null, null]
+ ]
+ },
+ "tbl2" : {
+ "schema": [
+ {"name": "strCol1", "type": "STRING"},
+ {"name": "strCol2", "type": "STRING"},
+ {"name": "intCol1", "type": "INT"},
+ {"name": "doubleCol1", "type": "DOUBLE"}
+ ],
+ "inputs": [
+ ["foo", "bob", 3, 3.1416],
+ ["alice", "alice", 4, 2.7183],
+ [null, null, null, null]
+ ]
+ },
+ "tbl3": {
+ "schema": [
+ {"name": "strCol1", "type": "STRING"},
+ {"name": "intCol1", "type": "INT"},
+ {"name": "strCol2", "type": "STRING"}
+ ],
+ "inputs": [
+ ["foo", 1, "foo"],
+ ["bar", 2, "foo"]
+ ]
+ }
+ },
+ "queries": [
+ {
+ "description": "join 3 tables, mixed join conditions with null
non-matching",
+ "sql": "SET enableNullHandling=true; SELECT * FROM {tbl1} JOIN {tbl2}
ON {tbl1}.intCol1 > {tbl2}.doubleCol1 JOIN {tbl3} ON {tbl1}.strCol1 =
{tbl3}.strCol2"
+ },
+ {
+ "description": "join 3 tables, mixed join condition with null
matching",
+ "sql": "SET enableNullHandling=true; SELECT * FROM {tbl1} JOIN {tbl2}
ON {tbl1}.intCol1 != {tbl2}.doubleCol1 JOIN {tbl3} ON {tbl1}.strCol1 =
{tbl3}.strCol2"
+ },
+ {
+ "description": "join 2 tables, mixed join conditions of null matching
or non-matching",
+ "sql": "SET enableNullHandling=true; SELECT * FROM {tbl1} JOIN {tbl2}
ON {tbl1}.intCol1 > {tbl2}.doubleCol1 AND {tbl1}.strCol1 = {tbl2}.strCol1"
+ },
+
+ {
+ "description": "intCol1 IS NULL is always false",
+ "sql": "SET enableNullHandling=true; SELECT 1 FROM {tbl1} WHERE
intCol1 IS NULL",
+ "h2Sql": "SELECT 'empty' FROM {tbl1} WHERE 1 = 0"
+ },
+ {
+ "description": "intCol1 IS NOT NULL is always true",
+ "sql": "SET enableNullHandling=true; SELECT intCol1 FROM {tbl1} WHERE
intCol1 IS NOT NULL",
+ "h2Sql": "SELECT intCol1 FROM {tbl1} WHERE 1 = 1"
+ },
+ {
+ "description": "nIntCol1 IS NULL is honored",
+ "sql": "SET enableNullHandling=true; SELECT nIntCol1 FROM {tbl1} WHERE
nIntCol1 IS NULL"
+ },
+ {
+ "description": "nIntCol1 IS NOT NULL is honored",
+ "sql": "SET enableNullHandling=true; SELECT nIntCol1 FROM {tbl1} WHERE
nIntCol1 IS NOT NULL"
+ },
+ {
+ "description": "nnIntCol1 IS NULL is always false",
+ "sql": "SET enableNullHandling=true; SELECT 1 FROM {tbl1} WHERE
nnIntCol1 IS NULL",
+ "h2Sql": "SELECT 'empty' FROM {tbl1} WHERE 1 = 0"
+ },
+ {
+ "description": "nnIntCol1 IS NOT NULL is always true",
+ "sql": "SET enableNullHandling=true; SELECT nnIntCol1 FROM {tbl1}
WHERE nnIntCol1 IS NOT NULL",
+ "h2Sql": "SELECT nnIntCol1 FROM {tbl1} WHERE 1 = 1"
+ },
+
+ {
+ "description": "When projected with enableNullHandling=true, intCol1
is considered -2147483648",
+ "comment": "This test fails when it shouldn't. We need to fix this
before merging",
Review Comment:
We need to decide what to do in this case. For compatibility reasons V1
needs to treat the value here as a null, but V2 doesn't expect that. Maybe we
could add a new flag as suggested by @walterddr
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]