diff options
| author | Pavel Velikhov <[email protected]> | 2026-07-02 20:56:08 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-02 17:56:08 +0000 |
| commit | 6fd8e67feb6dc4e0273cdfccc8446a106902ca98 (patch) | |
| tree | 8a6e65fbe53c760bbbdb05d03ec6248b00c522f2 | |
| parent | 17f5b6533ec21c001e5d48b2d21f2837cb9270f8 (diff) | |
Improve constant folding of UDFs (#45316)
Co-authored-by: Velikhov Pavel <[email protected]>
| -rw-r--r-- | ydb/core/kqp/opt/cbo/solver/kqp_opt_stat.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ydb/core/kqp/opt/cbo/solver/kqp_opt_stat.cpp b/ydb/core/kqp/opt/cbo/solver/kqp_opt_stat.cpp index 1b03b0ecc7b..2c09a8211fb 100644 --- a/ydb/core/kqp/opt/cbo/solver/kqp_opt_stat.cpp +++ b/ydb/core/kqp/opt/cbo/solver/kqp_opt_stat.cpp @@ -90,7 +90,8 @@ namespace { if (!TCoApply::Match(input.Get())) { return false; } - if (input->ChildrenSize() != 2) { + + if (input->ChildrenSize() != 2 && input->ChildrenSize() != 3) { return false; } if (input->Child(0)->IsCallable("Udf")) { @@ -102,10 +103,12 @@ namespace { } } if (withParams) { - return IsConstantExprWithParams(input->Child(1)); + return IsConstantExprWithParams(input->Child(1)) || IsConstantUdf(input->Child(1)); } else { - return IsConstantExpr(input->Child(1)); + return IsConstantExpr(input->Child(1)) || IsConstantUdf(input->Child(1)); } + } else if (TCoApply::Match(input->Child(1))){ + return IsConstantUdf(input->ChildPtr(1)); } return false; } |
