@@ -426,34 +426,6 @@ TConclusion<bool> TGraph::OptimizeConditionsForIndexes(TGraphNode* condNode) {
426
426
return true ;
427
427
}
428
428
429
- bool TGraph::IsBoolResultYqlOperator (const NYql::TKernelRequestBuilder::EBinaryOp op) const {
430
- switch (op) {
431
- case NYql::TKernelRequestBuilder::EBinaryOp::And:
432
- case NYql::TKernelRequestBuilder::EBinaryOp::Or:
433
- case NYql::TKernelRequestBuilder::EBinaryOp::Xor:
434
- return true ;
435
- case NYql::TKernelRequestBuilder::EBinaryOp::Add:
436
- case NYql::TKernelRequestBuilder::EBinaryOp::Sub:
437
- case NYql::TKernelRequestBuilder::EBinaryOp::Mul:
438
- case NYql::TKernelRequestBuilder::EBinaryOp::Div:
439
- case NYql::TKernelRequestBuilder::EBinaryOp::Mod:
440
- case NYql::TKernelRequestBuilder::EBinaryOp::Coalesce:
441
- return false ;
442
-
443
- case NYql::TKernelRequestBuilder::EBinaryOp::StartsWith:
444
- case NYql::TKernelRequestBuilder::EBinaryOp::EndsWith:
445
- case NYql::TKernelRequestBuilder::EBinaryOp::StringContains:
446
-
447
- case NYql::TKernelRequestBuilder::EBinaryOp::Equals:
448
- case NYql::TKernelRequestBuilder::EBinaryOp::NotEquals:
449
- case NYql::TKernelRequestBuilder::EBinaryOp::Less:
450
- case NYql::TKernelRequestBuilder::EBinaryOp::LessOrEqual:
451
- case NYql::TKernelRequestBuilder::EBinaryOp::Greater:
452
- case NYql::TKernelRequestBuilder::EBinaryOp::GreaterOrEqual:
453
- return true ;
454
- }
455
- }
456
-
457
429
TConclusion<bool > TGraph::OptimizeConditionsForHeadersCheck (TGraphNode* condNode) {
458
430
if (condNode->GetProcessor ()->GetProcessorType () != EProcessorType::Calculation) {
459
431
return false ;
@@ -467,17 +439,7 @@ TConclusion<bool> TGraph::OptimizeConditionsForHeadersCheck(TGraphNode* condNode
467
439
}
468
440
auto * dest = condNode->GetOutputEdges ().begin ()->second ;
469
441
const ui32 destResourceId = condNode->GetOutputEdges ().begin ()->first .GetResourceId ();
470
- if (!!calc->GetKernelLogic ()) {
471
- if (!calc->GetKernelLogic ()->IsBoolInResult ()) {
472
- return false ;
473
- }
474
- }
475
- if (calc->GetYqlOperationId ()) {
476
- if (!IsBoolResultYqlOperator ((NYql::TKernelRequestBuilder::EBinaryOp)*calc->GetYqlOperationId ())) {
477
- return false ;
478
- }
479
- }
480
- if (!calc->GetYqlOperationId () && !calc->GetKernelLogic ()) {
442
+ if (!calc->GetKernelLogic () || !calc->GetKernelLogic ()->IsBoolInResult ()) {
481
443
return false ;
482
444
}
483
445
auto * node = GetProducerVerified (condNode->GetProcessor ()->GetInput ()[0 ].GetColumnId ());
@@ -527,10 +489,11 @@ TConclusion<bool> TGraph::OptimizeFilterWithCoalesce(TGraphNode* cNode) {
527
489
return false ;
528
490
}
529
491
const auto calc = cNode->GetProcessorAs <TCalculationProcessor>();
530
- if (!calc->GetYqlOperationId ()) {
492
+ if (!calc->GetKernelLogic ()-> GetYqlOperationId ()) {
531
493
return false ;
532
494
}
533
- if ((NYql::TKernelRequestBuilder::EBinaryOp)*calc->GetYqlOperationId () != NYql::TKernelRequestBuilder::EBinaryOp::Coalesce) {
495
+ if ((NYql::TKernelRequestBuilder::EBinaryOp)*calc->GetKernelLogic ()->GetYqlOperationId () !=
496
+ NYql::TKernelRequestBuilder::EBinaryOp::Coalesce) {
534
497
return false ;
535
498
}
536
499
if (cNode->GetOutputEdges ().size () != 1 ) {
@@ -551,30 +514,14 @@ TConclusion<bool> TGraph::OptimizeFilterWithCoalesce(TGraphNode* cNode) {
551
514
552
515
auto * nextNode = cNode->GetOutputEdges ().begin ()->second ;
553
516
if (nextNode->GetProcessor ()->GetProcessorType () != EProcessorType::Filter) {
554
- if (nextNode->GetProcessor ()->GetProcessorType () == EProcessorType::Calculation) {
555
- const auto outputCalc = nextNode->GetProcessorAs <TCalculationProcessor>();
556
- if (!outputCalc->GetYqlOperationId ()) {
557
- return false ;
558
- }
559
- if ((NYql::TKernelRequestBuilder::EBinaryOp)*outputCalc->GetYqlOperationId () != NYql::TKernelRequestBuilder::EBinaryOp::And) {
560
- return false ;
561
- }
562
- } else if (nextNode->GetProcessor ()->GetProcessorType () == EProcessorType::StreamLogic) {
563
- const auto outputCalc = nextNode->GetProcessorAs <TStreamLogicProcessor>();
564
- if (outputCalc->GetOperation () != NKernels::EOperation::And) {
565
- return false ;
566
- }
517
+ if (nextNode->GetProcessor ()->GetProcessorType () != EProcessorType::StreamLogic) {
518
+ return false ;
567
519
}
568
- if (nextNode->GetOutputEdges ().size () != 1 ) {
520
+ const auto outputCalc = nextNode->GetProcessorAs <TStreamLogicProcessor>();
521
+ if (outputCalc->GetOperation () != NKernels::EOperation::And) {
569
522
return false ;
570
523
}
571
- if (nextNode->GetOutputEdges ().begin ()->second ->GetProcessor ()->GetProcessorType () == EProcessorType::StreamLogic) {
572
- const auto outputCalc = nextNode->GetOutputEdges ().begin ()->second ->GetProcessorAs <TStreamLogicProcessor>();
573
- if (outputCalc->GetOperation () != NKernels::EOperation::And) {
574
- return false ;
575
- }
576
- } else if (nextNode->GetOutputEdges ().begin ()->second ->GetProcessor ()->GetProcessorType () == EProcessorType::Filter) {
577
- } else {
524
+ if (nextNode->GetOutputEdges ().size () != 1 ) {
578
525
return false ;
579
526
}
580
527
}
0 commit comments