diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-03-30 15:16:27 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-03-30 15:16:27 +0300 |
commit | 906058e47713f171f0b30ff0cd0ae2b24ce87324 (patch) | |
tree | a79fb775a0c37b7f403340064ac5b55fa8838f07 | |
parent | e532aeffaf6aea20dc905d0d8974bff82ebe129c (diff) | |
download | ydb-906058e47713f171f0b30ff0cd0ae2b24ce87324.tar.gz |
YQL-15415 YQL-15435 Support Top in Kqp.
-rw-r--r-- | ydb/core/kqp/opt/physical/kqp_opt_phy_sort.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ydb/core/kqp/opt/physical/kqp_opt_phy_sort.cpp b/ydb/core/kqp/opt/physical/kqp_opt_phy_sort.cpp index 4b09bf06556..d8adc43b99d 100644 --- a/ydb/core/kqp/opt/physical/kqp_opt_phy_sort.cpp +++ b/ydb/core/kqp/opt/physical/kqp_opt_phy_sort.cpp @@ -25,15 +25,15 @@ TExprBase KqpRemoveRedundantSortByPkBase( bool allowSortForAllTables = false) { auto maybeSort = node.Maybe<TCoSort>(); - auto maybeTopSort = node.Maybe<TCoTopSort>(); + auto maybeTopBase = node.Maybe<TCoTopBase>(); - if (!maybeSort && !maybeTopSort) { + if (!maybeSort && !maybeTopBase) { return node; } - auto input = maybeSort ? maybeSort.Cast().Input() : maybeTopSort.Cast().Input(); - auto sortDirections = maybeSort ? maybeSort.Cast().SortDirections() : maybeTopSort.Cast().SortDirections(); - auto keySelector = maybeSort ? maybeSort.Cast().KeySelectorLambda() : maybeTopSort.Cast().KeySelectorLambda(); + auto input = maybeSort ? maybeSort.Cast().Input() : maybeTopBase.Cast().Input(); + auto sortDirections = maybeSort ? maybeSort.Cast().SortDirections() : maybeTopBase.Cast().SortDirections(); + auto keySelector = maybeSort ? maybeSort.Cast().KeySelectorLambda() : maybeTopBase.Cast().KeySelectorLambda(); auto maybeFlatmap = input.Maybe<TCoFlatMap>(); @@ -155,10 +155,10 @@ TExprBase KqpRemoveRedundantSortByPkBase( .Done(); } - if (maybeTopSort) { + if (maybeTopBase) { return Build<TCoTake>(ctx, node.Pos()) .Input(input) - .Count(maybeTopSort.Cast().Count()) + .Count(maybeTopBase.Cast().Count()) .Done(); } else { return input; @@ -212,7 +212,7 @@ NYql::NNodes::TExprBase KqpRemoveRedundantSortByPkOverSource( if (expr.Maybe<TDqConnection>() || expr.Maybe<TDqPrecompute>() || expr.Maybe<TDqPhyPrecompute>()) { return false; } - if (TCoSort::Match(expr.Raw()) || TCoTopSort::Match(expr.Raw())) { + if (TCoSort::Match(expr.Raw()) || TCoTopBase::Match(expr.Raw())) { auto newExpr = KqpRemoveRedundantSortByPkBase(expr, exprCtx, kqpCtx, [&](TExprBase node) -> TMaybe<TTableData> { if (node.Ptr() != node.Ptr()) { |