aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraidarsamer <aidarsamer@ydb.tech>2023-04-21 17:08:35 +0300
committeraidarsamer <aidarsamer@ydb.tech>2023-04-21 17:08:35 +0300
commit909fa8cb68ffe225d83c6a7a752126bf6134b393 (patch)
tree29ef3e4eddba1f8e6af0ae7f36ab45e7845501a7
parenta8158d8f49fafa4f5dcb1d4e7a9bd72cb72e65eb (diff)
downloadydb-909fa8cb68ffe225d83c6a7a752126bf6134b393.tar.gz
Enable LIKE pushdown to Column shards just for Utf8 type
-rw-r--r--ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter_collection.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter_collection.cpp b/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter_collection.cpp
index b9312668a0a..56117107ac5 100644
--- a/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter_collection.cpp
+++ b/ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter_collection.cpp
@@ -13,10 +13,7 @@ using namespace NYql::NNodes;
namespace {
-bool ColumnHasBinaryStringType(const TExprBase& expr) {
- if (!expr.Maybe<TCoMember>()) {
- return false;
- }
+bool ExprHasUtf8Type(const TExprBase& expr) {
auto typeAnn = expr.Ptr()->GetTypeAnn();
auto itemType = GetSeqItemType(typeAnn);
if (!itemType) {
@@ -26,7 +23,7 @@ bool ColumnHasBinaryStringType(const TExprBase& expr) {
return false;
}
auto dataTypeInfo = NUdf::GetDataTypeInfo(itemType->Cast<TDataExprType>()->GetSlot());
- return (std::string(dataTypeInfo.Name.data()) == "String");
+ return (std::string(dataTypeInfo.Name.data()) == "Utf8");
}
bool IsLikeOperator(const TCoCompare& predicate) {
@@ -40,6 +37,15 @@ bool IsLikeOperator(const TCoCompare& predicate) {
return false;
}
+bool IsSupportedLike(const TExprBase& left, const TExprBase& right) {
+ if ((left.Maybe<TCoMember>() && ExprHasUtf8Type(left))
+ || (right.Maybe<TCoMember>() && ExprHasUtf8Type(right)))
+ {
+ return true;
+ }
+ return false;
+}
+
bool IsSupportedPredicate(const TCoCompare& predicate) {
if (predicate.Maybe<TCoCmpEqual>()) {
return true;
@@ -294,7 +300,7 @@ bool CheckComparisonParametersForPushdown(const TCoCompare& compare, const TExpr
if (!IsComparableTypes(leftList[i], rightList[i], equality, inputType)) {
return false;
}
- if (IsLikeOperator(compare) && (ColumnHasBinaryStringType(leftList[i]) || ColumnHasBinaryStringType(rightList[i]))) {
+ if (IsLikeOperator(compare) && !IsSupportedLike(leftList[i], rightList[i])) {
// Currently Column Shard doesn't have LIKE kernel for binary strings
return false;
}