diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-04-06 20:09:32 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-04-06 20:09:32 +0300 |
commit | 25e969329b290c11487f74f566c225593e9661d4 (patch) | |
tree | 930aa4c4ea8bcd0b177bccf9b5c1cf08b22e8e21 | |
parent | c265ba9ef326b0d4eabb65d3a6e0f105cb0f0c3f (diff) | |
download | ydb-25e969329b290c11487f74f566c225593e9661d4.tar.gz |
YQL-15834 Try to workaround empty constraint on PartitionsByKeys input.
-rw-r--r-- | ydb/library/yql/core/common_opt/yql_co_simple1.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp index c964155ace0..a0b9f7ca406 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp @@ -6725,6 +6725,14 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { return node; }; + map["ShuffleByKeys"] = map["PartitionsByKeys"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { + if (IsEmpty(node->Head(), *optCtx.Types)) { + YQL_CLOG(DEBUG, Core) << node->Content() << " over empty input."; + return ctx.Builder(node->Pos()).Apply(node->Tail()).With(0, node->HeadPtr()).Seal().Build(); + } + return node; + }; + // will be applied to any callable after all above map[""] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { YQL_ENSURE(node->IsCallable()); |