diff options
author | aidarsamer <aidarsamer@ydb.tech> | 2022-12-20 12:49:26 +0300 |
---|---|---|
committer | aidarsamer <aidarsamer@ydb.tech> | 2022-12-20 12:49:26 +0300 |
commit | 58e50341cc234a4291453eea2ccd0ab451f07c2f (patch) | |
tree | baab75c94effa48e3dd3a2a9a35b6504bb901057 | |
parent | 04d2eb996bc6cb6ae828ef1e725ef007c7048ab6 (diff) | |
download | ydb-58e50341cc234a4291453eea2ccd0ab451f07c2f.tar.gz |
Fix not equal function to use Arrow not_equal function instead of 'not (equal)'
Fix not equal function to use Arrow not_equal function instead of 'not (equal)'
-rw-r--r-- | ydb/core/kqp/opt/physical/kqp_opt_phy_olap_filter.cpp | 24 | ||||
-rw-r--r-- | ydb/core/kqp/query_compiler/kqp_olap_compiler.cpp | 2 |
2 files changed, 10 insertions, 16 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 1b550f7576..84d89614aa 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 @@ -402,32 +402,24 @@ TExprBase BuildOneElementComparison(const std::pair<TExprBase, TExprBase>& param if (predicate.Maybe<TCoCmpEqual>()) { compareOperator = "eq"; + } else if (predicate.Maybe<TCoCmpNotEqual>()) { + compareOperator = "neq"; } else if (predicate.Maybe<TCoCmpLess>() || (predicate.Maybe<TCoCmpLessOrEqual>() && forceStrictComparison)) { compareOperator = "lt"; } else if (predicate.Maybe<TCoCmpLessOrEqual>() && !forceStrictComparison) { compareOperator = "lte"; } else if (predicate.Maybe<TCoCmpGreater>() || (predicate.Maybe<TCoCmpGreaterOrEqual>() && forceStrictComparison)) { compareOperator = "gt"; - } if (predicate.Maybe<TCoCmpGreaterOrEqual>() && !forceStrictComparison) { + } else if (predicate.Maybe<TCoCmpGreaterOrEqual>() && !forceStrictComparison) { compareOperator = "gte"; } - if (!compareOperator.empty()) { - return Build<TKqpOlapFilterCompare>(ctx, pos) - .Operator(ctx.NewAtom(pos, compareOperator)) - .Left(parameter.first) - .Right(parameter.second) - .Done(); - } + YQL_ENSURE(!compareOperator.empty(), "Unsupported comparison node: " << predicate.Ptr()->Content()); - YQL_ENSURE(predicate.Maybe<TCoCmpNotEqual>(), "Unsupported comparison node: " << predicate.Ptr()->Content()); - - return Build<TKqpOlapNot>(ctx, pos) - .Value<TKqpOlapFilterCompare>() - .Operator(ctx.NewAtom(pos, "eq")) - .Left(parameter.first) - .Right(parameter.second) - .Build() + return Build<TKqpOlapFilterCompare>(ctx, pos) + .Operator(ctx.NewAtom(pos, compareOperator)) + .Left(parameter.first) + .Right(parameter.second) .Done(); } diff --git a/ydb/core/kqp/query_compiler/kqp_olap_compiler.cpp b/ydb/core/kqp/query_compiler/kqp_olap_compiler.cpp index a0915341cd..56fb4be5b6 100644 --- a/ydb/core/kqp/query_compiler/kqp_olap_compiler.cpp +++ b/ydb/core/kqp/query_compiler/kqp_olap_compiler.cpp @@ -280,6 +280,8 @@ TProgram::TAssignment* CompileComparison(const TKqpOlapFilterCompare& comparison if (comparison.Operator() == "eq") { function = TProgram::TAssignment::FUNC_CMP_EQUAL; + } else if (comparison.Operator() == "neq") { + function = TProgram::TAssignment::FUNC_CMP_NOT_EQUAL; } else if (comparison.Operator() == "lt") { function = TProgram::TAssignment::FUNC_CMP_LESS; } else if (comparison.Operator() == "lte") { |