This is an automated email from the ASF dual-hosted git repository. mbudiu pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git
commit 26c05f7434a9d12af8d6334be96f90eb4dfa893c Author: Mihai Budiu <[email protected]> AuthorDate: Wed Oct 2 16:34:14 2024 -0700 [CALCITE-6607] RexExecutor can throw during evaluation Signed-off-by: Mihai Budiu <[email protected]> --- .../main/java/org/apache/calcite/rex/RexExecutorImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java b/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java index b32399b02f..17a28cf328 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java +++ b/core/src/main/java/org/apache/calcite/rex/RexExecutorImpl.java @@ -129,22 +129,20 @@ public class RexExecutorImpl implements RexExecutor { */ @Override public void reduce(RexBuilder rexBuilder, List<RexNode> constExps, List<RexNode> reducedValues) { - String code; try { - code = compile(rexBuilder, constExps, (list, index, storageType) -> { + String code = compile(rexBuilder, constExps, (list, index, storageType) -> { throw new UnsupportedOperationException(); }); + + final RexExecutable executable = new RexExecutable(code, constExps); + executable.setDataContext(dataContext); + executable.reduce(rexBuilder, constExps, reducedValues); } catch (RuntimeException ex) { // Give up on reduction and return expressions unchanged. // This effectively moves the error from compile time to runtime. // We could give a warning here if there was a mechanism for warnings. reducedValues.addAll(constExps); - return; } - - final RexExecutable executable = new RexExecutable(code, constExps); - executable.setDataContext(dataContext); - executable.reduce(rexBuilder, constExps, reducedValues); } /**
