ccaominh commented on a change in pull request #9488: Match GREATEST/LEAST function behavior to other DBs URL: https://github.com/apache/druid/pull/9488#discussion_r390016128
########## File path: docs/misc/math-expr.md ########## @@ -181,6 +181,22 @@ See javadoc of java.lang.Math for detailed explanation for each function. | all(lambda,arr) | returns 1 if all elements in the array matches the lambda expression, else 0 | +### Reduction functions + +Reduction functions operate on zero or more expressions and return a single expression. If no expressions are passed +as arguments, then the result is `NULL`. The expressions must all be convertible to a +common data type, which will be the type of the result: +* If any argument is `NULL`, the result is `NULL`. +* If the arguments comprise a mix of numbers and strings, the arguments are interpreted as strings. +* If all arguments are integer numbers, the arguments are interpreted as longs. +* If all arguments are numbers and at least one argument is a double, the arguments are interpreted as doubles. + +| function | description | +| --- | --- | +| greatest([expr1, ...]) | Returns the maximum expression across zero or more expressions. | Review comment: Thinking about it more, I'm not sure what the best wording would be since the expressions could all be strings (in which case, `greatest` returns the last value if they're all sorted alphabetically). "Largest" may be confused with "longest". Any suggestions? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org