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


##########
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:
   I was wrong. The expected result in this situation is to receive a null. 
This is a column where `nullable` is not defined and therefore column level 
nullability is delegated to `indexingConfig.nullHandlingEnabled`, which was 
true for this case.
   
   I've added a couple of extra tests to verify the correct behavior when 
`indexingConfig.nullHandlingEnabled` is false.



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