aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraneporada <aneporada@yandex-team.ru>2022-03-07 01:14:46 +0300
committeraneporada <aneporada@yandex-team.ru>2022-03-07 01:14:46 +0300
commit2b3c2a9f349d0ab9e4dc2ef8d5ed293d2d970424 (patch)
tree407ed613d99a74c1fa4c23a1fba3d725ee54b8ab
parentb53fb5d9edf7d9b2ce86d83f75c5d99801b2a6d2 (diff)
downloadydb-2b3c2a9f349d0ab9e4dc2ef8d5ed293d2d970424.tar.gz
[YQL-10265] Relax asserts in prepartion for WinOnRange/WinOnGroups
ref:0eaee7b33b715ced6440a483cc81418681dc59a4
-rw-r--r--ydb/library/yql/core/common_opt/yql_co_extr_members.cpp2
-rw-r--r--ydb/library/yql/core/type_ann/type_ann_list.cpp4
-rw-r--r--ydb/library/yql/core/yql_opt_window.cpp12
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_log.cpp2
4 files changed, 10 insertions, 10 deletions
diff --git a/ydb/library/yql/core/common_opt/yql_co_extr_members.cpp b/ydb/library/yql/core/common_opt/yql_co_extr_members.cpp
index 35b24e9439b..aeba7106033 100644
--- a/ydb/library/yql/core/common_opt/yql_co_extr_members.cpp
+++ b/ydb/library/yql/core/common_opt/yql_co_extr_members.cpp
@@ -586,7 +586,7 @@ TExprNode::TPtr ApplyExtractMembersToCalcOverWindow(const TExprNode::TPtr& node,
TExprNodeList newFrames;
for (const auto& winOnRows : calc.Frames().Ref().ChildrenList()) {
- YQL_ENSURE(winOnRows->IsCallable("WinOnRows"));
+ YQL_ENSURE(TCoWinOnBase::Match(winOnRows.Get()));
TExprNodeList newFrameItems;
newFrameItems.push_back(winOnRows->ChildPtr(0));
diff --git a/ydb/library/yql/core/type_ann/type_ann_list.cpp b/ydb/library/yql/core/type_ann/type_ann_list.cpp
index d39b41ecafa..92420a574c4 100644
--- a/ydb/library/yql/core/type_ann/type_ann_list.cpp
+++ b/ydb/library/yql/core/type_ann/type_ann_list.cpp
@@ -513,8 +513,8 @@ namespace {
return IGraphTransformer::TStatus::Error;
}
for (auto winOn: winList.Children()) {
- if (!winOn->IsCallable("WinOnRows")) {
- ctx.AddError(TIssue(ctx.GetPosition(winOn->Pos()), "Expected window params based in callable WinOnRows"));
+ if (!TCoWinOnBase::Match(winOn.Get())) {
+ ctx.AddError(TIssue(ctx.GetPosition(winOn->Pos()), "Expected WinOnRows/WinOnGroups/WinOnRange"));
return IGraphTransformer::TStatus::Error;
}
diff --git a/ydb/library/yql/core/yql_opt_window.cpp b/ydb/library/yql/core/yql_opt_window.cpp
index e85982c21f5..a08b72e9a07 100644
--- a/ydb/library/yql/core/yql_opt_window.cpp
+++ b/ydb/library/yql/core/yql_opt_window.cpp
@@ -162,8 +162,6 @@ TCalcOverWindowTraits ExtractCalcOverWindowTraits(const TExprNode::TPtr& frames,
TVector<const TItemExprType*> lagQueueStructItems;
for (auto& winOn : frames->ChildrenList()) {
- YQL_ENSURE(winOn->IsCallable("WinOnRows"));
-
TWindowFrameSettings frameSettings = TWindowFrameSettings::Parse(*winOn, ctx);
ui64 frameOutpace = 0;
@@ -2183,6 +2181,8 @@ TExprNode::TPtr TryExpandNonCompactFullFrames(TPositionHandle pos, const TExprNo
continue;
}
+ YQL_ENSURE(winOn->IsCallable("WinOnRows"));
+
TExprNodeList nonAggregates = { winOn->ChildPtr(0) };
TExprNodeList aggregates = { winOn->ChildPtr(0) };
@@ -2450,8 +2450,8 @@ TExprNode::TPtr RebuildCalcOverWindowGroup(TPositionHandle pos, const TExprNode:
TExprNodeList newFrames;
for (auto frameNode : calc.Frames().Ref().Children()) {
- YQL_ENSURE(frameNode->IsCallable("WinOnRows"));
- TExprNodeList winOnRowsArgs = { frameNode->ChildPtr(0) };
+ YQL_ENSURE(TCoWinOnBase::Match(frameNode.Get()));
+ TExprNodeList winOnArgs = { frameNode->ChildPtr(0) };
for (ui32 i = 1; i < frameNode->ChildrenSize(); ++i) {
auto kvTuple = frameNode->ChildPtr(i);
YQL_ENSURE(kvTuple->IsList());
@@ -2484,9 +2484,9 @@ TExprNode::TPtr RebuildCalcOverWindowGroup(TPositionHandle pos, const TExprNode:
traits = ctx.NewCallable(traits->Pos(), traits->Content(), std::move(args));
}
- winOnRowsArgs.push_back(ctx.NewList(kvTuple->Pos(), {columnName, traits}));
+ winOnArgs.push_back(ctx.NewList(kvTuple->Pos(), {columnName, traits}));
}
- newFrames.push_back(ctx.NewCallable(frameNode->Pos(), "WinOnRows", std::move(winOnRowsArgs)));
+ newFrames.push_back(ctx.ChangeChildren(*frameNode, std::move(winOnArgs)));
}
fixedCalcs.push_back(
diff --git a/ydb/library/yql/dq/opt/dq_opt_log.cpp b/ydb/library/yql/dq/opt/dq_opt_log.cpp
index 2dc4bef15c5..d2aded1075b 100644
--- a/ydb/library/yql/dq/opt/dq_opt_log.cpp
+++ b/ydb/library/yql/dq/opt/dq_opt_log.cpp
@@ -90,7 +90,7 @@ TExprBase DqRewriteTakeSortToTopSort(TExprBase node, TExprContext& ctx, const TP
TExprBase DqEnforceCompactPartition(TExprBase node, TExprList frames, TExprContext& ctx) {
for (const auto &frameNode : frames.Ref().Children()) {
- YQL_ENSURE(frameNode->IsCallable("WinOnRows"));
+ YQL_ENSURE(TCoWinOnBase::Match(frameNode.Get()));
auto frameSpec = frameNode->Child(0);
if (frameSpec->Type() == TExprNode::List) {