@@ -489,6 +489,12 @@ ui64 CompileSimpleArrowComparison(const TKqpOlapFilterBinaryOp& comparison, TKqp
489489 function = TProgram::TAssignment::FUNC_CMP_GREATER;
490490 } else if (comparison.Operator () == " gte" ) {
491491 function = TProgram::TAssignment::FUNC_CMP_GREATER_EQUAL;
492+ } else if (comparison.Operator () == " string_contains" ) {
493+ function = TProgram::TAssignment::FUNC_STR_MATCH;
494+ } else if (comparison.Operator () == " starts_with" ) {
495+ function = TProgram::TAssignment::FUNC_STR_STARTS_WITH;
496+ } else if (comparison.Operator () == " ends_with" ) {
497+ function = TProgram::TAssignment::FUNC_STR_ENDS_WITH;
492498 }
493499
494500 cmpFunc->SetId (function);
@@ -620,6 +626,7 @@ TTypedColumn CompileYqlKernelUnaryOperation(const TKqpOlapFilterUnaryOp& operati
620626 return {command->GetColumn ().GetId (), resultType};
621627}
622628
629+ [[maybe_unused]]
623630TTypedColumn CompileYqlKernelBinaryOperation (const TKqpOlapFilterBinaryOp& operation, TKqpOlapCompileContext& ctx)
624631{
625632 // Columns should be created before operation, otherwise operation fail to find columns
@@ -708,7 +715,6 @@ const TTypedColumn BuildLogicalProgram(const TExprNode::TChildrenType& args, con
708715 logicalFunc->SetFunctionType (TProgram::YQL_KERNEL);
709716 logicalFunc->SetYqlOperationId ((ui32)function);
710717 } else {
711- logicalFunc->SetFunctionType (function);
712718 logicalFunc->SetId ((ui32)function);
713719 }
714720
@@ -740,22 +746,38 @@ const TTypedColumn BuildLogicalNot(const TExprBase& arg, TKqpOlapCompileContext&
740746
741747TTypedColumn GetOrCreateColumnIdAndType (const TExprBase& node, TKqpOlapCompileContext& ctx) {
742748 if (const auto & maybeBinaryOp = node.Maybe <TKqpOlapFilterBinaryOp>()) {
743- if (const auto & binaryOp = maybeBinaryOp.Cast (); ctx.CheckYqlCompatibleArgsTypes (binaryOp)) {
744- return CompileYqlKernelBinaryOperation (binaryOp, ctx);
749+ if constexpr (NSsa::RuntimeVersion >= 4U ) {
750+ if (const auto & binaryOp = maybeBinaryOp.Cast (); ctx.CheckYqlCompatibleArgsTypes (binaryOp)) {
751+ return CompileYqlKernelBinaryOperation (binaryOp, ctx);
752+ } else {
753+ return {
754+ ConvertSafeCastToColumn (CompileSimpleArrowComparison (binaryOp, ctx), " Uint8" , ctx),
755+ ctx.ExprCtx ().MakeType <TBlockExprType>(ctx.ExprCtx ().MakeType <TDataExprType>(EDataSlot::Bool))
756+ };
757+ }
745758 } else {
746759 return {
747- ConvertSafeCastToColumn ( CompileSimpleArrowComparison (binaryOp, ctx), " Uint8 " , ctx),
748- ctx.ExprCtx ().MakeType <TBlockExprType>(ctx.ExprCtx ().MakeType <TDataExprType>(EDataSlot::Uint8 ))
760+ CompileSimpleArrowComparison (maybeBinaryOp. Cast () , ctx),
761+ ctx.ExprCtx ().MakeType <TBlockExprType>(ctx.ExprCtx ().MakeType <TDataExprType>(EDataSlot::Bool ))
749762 };
750763 }
751764 } else if (const auto & maybeUnaryOp = node.Maybe <TKqpOlapFilterUnaryOp>()) {
752765 return CompileYqlKernelUnaryOperation (maybeUnaryOp.Cast (), ctx);
753766 } else if (const auto & maybeAnd = node.Maybe <TKqpOlapAnd>()) {
754- return BuildLogicalProgram (maybeAnd.Ref ().Children (), TKernelRequestBuilder::EBinaryOp::And, ctx);
767+ if constexpr (NSsa::RuntimeVersion >= 4U )
768+ return BuildLogicalProgram (maybeAnd.Ref ().Children (), TKernelRequestBuilder::EBinaryOp::And, ctx);
769+ else
770+ return BuildLogicalProgram (maybeAnd.Ref ().Children (), TProgram::TAssignment::FUNC_BINARY_AND, ctx);
755771 } else if (const auto & maybeOr = node.Maybe <TKqpOlapOr>()) {
756- return BuildLogicalProgram (maybeOr.Ref ().Children (), TKernelRequestBuilder::EBinaryOp::Or, ctx);
772+ if constexpr (NSsa::RuntimeVersion >= 4U )
773+ return BuildLogicalProgram (maybeOr.Ref ().Children (), TKernelRequestBuilder::EBinaryOp::Or, ctx);
774+ else
775+ return BuildLogicalProgram (maybeOr.Ref ().Children (), TProgram::TAssignment::FUNC_BINARY_OR, ctx);
757776 } else if (const auto & maybeXor = node.Maybe <TKqpOlapXor>()) {
758- return BuildLogicalProgram (maybeXor.Ref ().Children (), TKernelRequestBuilder::EBinaryOp::Xor, ctx);
777+ if constexpr (NSsa::RuntimeVersion >= 4U )
778+ return BuildLogicalProgram (maybeXor.Ref ().Children (), TKernelRequestBuilder::EBinaryOp::Xor, ctx);
779+ else
780+ return BuildLogicalProgram (maybeXor.Ref ().Children (), TProgram::TAssignment::FUNC_BINARY_XOR, ctx);
759781 } else if (const auto & maybeNot = node.Maybe <TKqpOlapNot>()) {
760782 return BuildLogicalNot (maybeNot.Cast ().Value (), ctx);
761783 } else if (const auto & maybeJsonValue = node.Maybe <TKqpOlapJsonValue>()) {
0 commit comments