normanj-bitquill commented on code in PR #3828: URL: https://github.com/apache/calcite/pull/3828#discussion_r1663134348
########## core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java: ########## @@ -1900,6 +1902,60 @@ private static class GreatestConvertlet implements SqlRexConvertlet { } } + /** Convertlet that converts {@code GREATEST} and {@code LEAST}. */ + private static class GreatestPgConvertlet implements SqlRexConvertlet { + @Override public RexNode convertCall(SqlRexContext cx, SqlCall call) { Review Comment: An expression like `GREATEST(1, 2, ...)` is compiled and becomes a `SqlCall` object with arguments. The convertlet will then replace the `SqlCall` object with a new `SqlCall` for `CASE`. We are only manipulating objects after they are parsed, we do not generate SQL text and parse it again. This will still explode original expression and use potentially much more memory. With simple integer arguments, this PR works with at least 1000 values. If no limit is in place, the user is still restricted by the max query length and what will fit in memory after the convertlet is run. -- 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...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org