walterddr commented on code in PR #9846:
URL: https://github.com/apache/pinot/pull/9846#discussion_r1033897487


##########
pinot-query-runtime/src/test/resources/queries/Case.json:
##########
@@ -0,0 +1,71 @@
+{
+  "case_when_test": {
+    "tables": {
+      "tbl1": {
+        "schema":[
+          {"name": "intCol", "type": "INT"},
+          {"name": "boolCol", "type": "BOOLEAN"},
+          {"name": "floatCol", "type": "FLOAT"},
+          {"name": "doubleCol", "type": "DOUBLE"},
+          {"name": "strCol", "type": "STRING"}
+        ],
+        "inputs": [
+          [1, true, 2.0, 3.0, "one"],
+          [2, false, 4.0, 6.0, "two"],
+          [3, true, 6.0, 9.0, "three"],
+          [4, false, 8.0, 12.0, "four"]
+        ]
+      }
+    },
+    "queries": [
+      { "sql": "SELECT intCol, CASE WHEN boolCol = true THEN 'Yes' ELSE 'No' 
END AS boolVal, strCol FROM {tbl1}"},
+      { "sql": "SELECT intCol, CASE WHEN strCol = 'one' THEN 'The first one' 
WHEN strCol = 'two' THEN 'The second one' WHEN strCol = 'three' THEN 'The third 
one' WHEN strCol = 'four' THEN 'The fourth one' ELSE 'Unknown' END AS stringVal 
FROM {tbl1}"},
+      { "sql": "SELECT intCol, CASE WHEN intCol % 2 = 0 THEN intCol ELSE 
intCol * 2 END AS intVal, strCol FROM {tbl1}"},
+      { "sql": "SELECT intCol, CASE WHEN floatCol > 4.0 THEN floatCol ELSE 
floatCol / 2.0 END AS floatVal, strCol FROM {tbl1}"},
+      { "sql": "SELECT intCol, CASE WHEN doubleCol > 6.0 THEN doubleCol ELSE 
doubleCol / 2.0 END AS doubleVal, strCol FROM {tbl1}"},
+      { "sql": "SELECT intCol, CASE WHEN (SELECT SUM(floatCol) FROM {tbl1}) > 
16.0 THEN 'Large sum' ELSE 'Small sum' END AS aggVal, strCol FROM {tbl1}"}
+    ]
+  },
+  "nested_case_when_test": {
+    "tables": {
+      "tbl1": {
+        "schema":[
+          {"name": "primary_key", "type": "INT"},
+          {"name": "description", "type": "STRING"}
+        ],
+        "inputs": [
+          [1, "Item one"],
+          [2, "Item two"],
+          [3, "Item three"],
+          [4, "Item four"]
+        ]
+      },
+      "tbl2": {
+        "schema":[
+          {"name": "primary_key", "type": "INT"},
+          {"name": "attribute", "type": "STRING"}
+        ],
+        "inputs": [
+          [1, "apple"],
+          [2, "chocolate"],
+          [3, "red"],
+          [4, "thirty"]
+        ]
+      }
+    },
+    "queries": [

Review Comment:
   can we add 
   1. using case when in filter
   2. case when without else (i think we don't support this so put an ignore if 
that's the case)



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