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


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunction.java:
##########
@@ -84,17 +84,40 @@ public void init(List<TransformFunction> arguments, 
Map<String, DataSource> data
     }
     int numWhenStatements = arguments.size() / 2;
     _whenStatements = new ArrayList<>(numWhenStatements);
+    _elseThenStatements = new ArrayList<>(numWhenStatements + 1);
+    constructStatementList(arguments);
+    _selections = new boolean[_elseThenStatements.size()];
+    Collections.reverse(_elseThenStatements);
+    Collections.reverse(_whenStatements);
+    _resultMetadata = calculateResultMetadata();
+  }
+
+  private void constructStatementList(List<TransformFunction> arguments) {
+    int numWhenStatements = arguments.size() / 2;
+    boolean hasLegacyFormat = false;
+    for (int i = 0; i < numWhenStatements; i++) {
+      if (arguments.get(i * 2).getResultMetadata().getDataType() != 
DataType.BOOLEAN) {
+        hasLegacyFormat = true;
+        break;

Review Comment:
   got it. yeah also this is not in critical path i will just make sure the 
check occurs afterward by looping it again



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

Reply via email to