aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzverevgeny <zverevgeny@ydb.tech>2025-02-27 21:40:13 +0300
committerGitHub <noreply@github.com>2025-02-27 21:40:13 +0300
commitf43e9dddc0145e2e003e6ee32eaf0cfc543d258d (patch)
tree02a5282e84a34b7db4d0e6c19e6f5194fa04a7cc
parente2e92e47ba28b4bb3ebb43d9c2cedc60ec47017f (diff)
downloadydb-f43e9dddc0145e2e003e6ee32eaf0cfc543d258d.tar.gz
handle JsonExists pushdown simularily to JsonValue (#15151)
-rw-r--r--ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter.cpp b/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter.cpp
index a995302526..98a90b6830 100644
--- a/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter.cpp
+++ b/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter.cpp
@@ -204,6 +204,15 @@ TMaybeNode<TExprBase> YqlApplyPushdown(const TExprBase& apply, const TExprNode&
.Done();
}
+TMaybeNode<TExprBase> JsonExistsPushdown(const TCoJsonExists& jsonExists, TExprContext& ctx, TPositionHandle pos)
+{
+ auto columnName = jsonExists.Json().Cast<TCoMember>().Name();
+ return Build<TKqpOlapJsonExists>(ctx, pos)
+ .Column(columnName)
+ .Path(jsonExists.JsonPath().Cast<TCoUtf8>())
+ .Done();
+}
+
std::vector<TExprBase> ConvertComparisonNode(const TExprBase& nodeIn, const TExprNode& argument, TExprContext& ctx, TPositionHandle pos)
{
std::vector<TExprBase> out;
@@ -249,6 +258,10 @@ std::vector<TExprBase> ConvertComparisonNode(const TExprBase& nodeIn, const TExp
return builder.Done();
}
+ if (auto maybeJsonExists = node.Maybe<TCoJsonExists>()) {
+ return JsonExistsPushdown(maybeJsonExists.Cast(), ctx, pos);
+ }
+
if (const auto maybeJust = node.Maybe<TCoJust>()) {
if (const auto params = ConvertComparisonNode(maybeJust.Cast().Input(), argument, ctx, pos); 1U == params.size()) {
return Build<TKqpOlapFilterUnaryOp>(ctx, node.Pos())
@@ -515,15 +528,6 @@ TMaybeNode<TExprBase> ExistsPushdown(const TCoExists& exists, TExprContext& ctx,
.Done();
}
-TMaybeNode<TExprBase> JsonExistsPushdown(const TCoJsonExists& jsonExists, TExprContext& ctx, TPositionHandle pos)
-{
- auto columnName = jsonExists.Json().Cast<TCoMember>().Name();
- return Build<TKqpOlapJsonExists>(ctx, pos)
- .Column(columnName)
- .Path(jsonExists.JsonPath().Cast<TCoUtf8>())
- .Done();
-}
-
TMaybeNode<TExprBase> SafeCastPredicatePushdown(const TCoFlatMap& inputFlatmap, const TExprNode& argument, TExprContext& ctx, TPositionHandle pos)
{
/*
@@ -572,10 +576,7 @@ TMaybeNode<TExprBase> CoalescePushdown(const TCoCoalesce& coalesce, const TExprN
return SafeCastPredicatePushdown(maybeFlatmap.Cast(), argument, ctx, pos);
} else if (auto maybePredicate = predicate.Maybe<TCoCompare>()) {
return SimplePredicatePushdown(maybePredicate.Cast(), argument, ctx, pos);
- } else if (auto maybeJsonExists = predicate.Maybe<TCoJsonExists>()) {
- return JsonExistsPushdown(maybeJsonExists.Cast(), ctx, pos);
}
-
return NullNode;
}