Currently CASE statements don't follow SQL conventions to short circuit at the first match. In the documentation, we have a given example:
SELECT
CASE
WHEN price > 30 THEN 3
WHEN price > 20 THEN 2
WHEN price > 10 THEN 1
ELSE 0
END AS price_category
FROM myTable
This results in the last met WHEN condition taking precedence instead of the first. In the example above, all values with price > 10 will evaluate to 1.
Curious if this is intentional for any reason as the code below explicitly takes the max condition index. Otherwise, happy to make this change.
Currently CASE statements don't follow SQL conventions to short circuit at the first match. In the documentation, we have a given example:
This results in the last met WHEN condition taking precedence instead of the first. In the example above, all values with
price > 10
will evaluate to 1.Curious if this is intentional for any reason as the code below explicitly takes the max condition index. Otherwise, happy to make this change.
https://github.com/apache/pinot/blob/5cd6a7dc05135a82f8dc292efcce682c8d377338/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunction.java#L226-L232