gortiz commented on code in PR #11824:
URL: https://github.com/apache/pinot/pull/11824#discussion_r1373109203


##########
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",
+        "sql": "SET enableNullHandling=true; SELECT intCol1 FROM {tbl1} WHERE 
strCol1 = 'bob'",
+        "h2Sql": "SELECT -2147483648 FROM {tbl1} WHERE strCol1 = 'bob'"
+      },
+      {
+        "description": "When projected with enableNullHandling=false, intCol1 
is considered -2147483648",
+        "comment": "this tests is not correctly working. Returned `intCol1` is 
actually null",
+        "sql": "SET enableNullHandling=false; SELECT intCol1 FROM {tbl1} WHERE 
strCol1 = 'bob'",
+        "h2Sql": "SELECT -2147483648 FROM {tbl1} WHERE strCol1 = 'bob'"
+      },
+      {
+        "description": "When projected with enableNullHandling=true, nIntCol1 
is considered null",
+        "sql": "SET enableNullHandling=true; SELECT nIntCol1 FROM {tbl1} WHERE 
strCol1 = 'bob'",
+        "h2Sql": "SELECT null FROM {tbl1} WHERE strCol1 = 'bob'"
+      },
+      {
+        "description": "When projected with enableNullHandling=false, nIntCol1 
is considered -2147483648",
+        "sql": "SET enableNullHandling=false; SELECT nIntCol1 FROM {tbl1} 
WHERE strCol1 = 'bob'",
+        "h2Sql": "SELECT -2147483648 FROM {tbl1} WHERE strCol1 = 'bob'"
+      },
+      {
+        "description": "When projected with enableNullHandling=true, nnIntCol1 
is considered -2147483648",
+        "comment": "This test fails when it shouldn't. We need to fix this 
before merging",

Review Comment:
   Like https://github.com/apache/pinot/pull/11824/files#r1373108641



-- 
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