walterddr commented on code in PR #9702:
URL: https://github.com/apache/pinot/pull/9702#discussion_r1012150602
##########
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:
`if (all_first_half_are_expression_boolean_type &&
odd_half_has_non_boolean_type) then use`
--
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]