@@ -80,12 +80,9 @@ struct TGraceJoinPacker {
80
80
ui64 DataIColumnsNum = TotalIColumnsNum - KeyIColumnsNum;
81
81
std::vector<GraceJoin::TColTypeInterface> ColumnInterfaces;
82
82
bool IsAny; // Flag to support any join attribute
83
- const NUdf::TLoggerPtr Logger; // Logger instance
84
- const NUdf::TLogComponentId LogComponent; // Id of current component for logging. GracejJoin here
85
83
inline void Pack () ; // Packs new tuple from TupleHolder and TuplePtrs to TupleIntVals, TupleStrSizes, TupleStrings
86
84
inline void UnPack (); // Unpacks packed values from TupleIntVals, TupleStrSizes, TupleStrings into TupleHolder and TuplePtrs
87
- TGraceJoinPacker (const std::vector<TType*>& columnTypes, const std::vector<ui32>& keyColumns,
88
- const THolderFactory& holderFactory, bool isAny, NUdf::TLoggerPtr logger, NUdf::TLogComponentId logComponent);
85
+ TGraceJoinPacker (const std::vector<TType*>& columnTypes, const std::vector<ui32>& keyColumns, const THolderFactory& holderFactory, bool isAny);
89
86
};
90
87
91
88
@@ -433,13 +430,10 @@ void TGraceJoinPacker::UnPack() {
433
430
}
434
431
435
432
436
- TGraceJoinPacker::TGraceJoinPacker (const std::vector<TType *> & columnTypes, const std::vector<ui32>& keyColumns,
437
- const THolderFactory& holderFactory, bool isAny, NUdf::TLoggerPtr logger = nullptr , NUdf::TLogComponentId logComponent = 0 ) :
433
+ TGraceJoinPacker::TGraceJoinPacker (const std::vector<TType *> & columnTypes, const std::vector<ui32>& keyColumns, const THolderFactory& holderFactory, bool isAny) :
438
434
ColumnTypes (columnTypes)
439
435
, HolderFactory(holderFactory)
440
- , IsAny(isAny)
441
- , Logger(logger)
442
- , LogComponent(logComponent) {
436
+ , IsAny(isAny) {
443
437
444
438
ui64 nColumns = ColumnTypes.size ();
445
439
ui64 nKeyColumns = keyColumns.size ();
@@ -556,9 +550,8 @@ TGraceJoinPacker::TGraceJoinPacker(const std::vector<TType *> & columnTypes, con
556
550
}
557
551
558
552
TablePtr = std::make_unique<GraceJoin::TTable>(
559
- Logger, LogComponent,
560
553
PackedKeyIntColumnsNum, KeyStrColumnsNum, PackedDataIntColumnsNum,
561
- DataStrColumnsNum, KeyIColumnsNum, DataIColumnsNum, NullsBitmapSize, cti_p, IsAny);
554
+ DataStrColumnsNum, KeyIColumnsNum, DataIColumnsNum, NullsBitmapSize, cti_p, IsAny );
562
555
563
556
}
564
557
@@ -576,7 +569,7 @@ class TGraceJoinSpillingSupportState : public TComputationValue<TGraceJoinSpilli
576
569
EJoinKind joinKind, EAnyJoinSettings anyJoinSettings, const std::vector<ui32>& leftKeyColumns, const std::vector<ui32>& rightKeyColumns,
577
570
const std::vector<ui32>& leftRenames, const std::vector<ui32>& rightRenames,
578
571
const std::vector<TType*>& leftColumnsTypes, const std::vector<TType*>& rightColumnsTypes, TComputationContext& ctx,
579
- const bool isSelfJoin, bool isSpillingAllowed, NUdf::TLoggerPtr logger, NUdf::TLogComponentId logComponent )
572
+ const bool isSelfJoin, bool isSpillingAllowed)
580
573
: TBase(memInfo)
581
574
, FlowLeft(flowLeft)
582
575
, FlowRight(flowRight)
@@ -585,20 +578,18 @@ class TGraceJoinSpillingSupportState : public TComputationValue<TGraceJoinSpilli
585
578
, RightKeyColumns(rightKeyColumns)
586
579
, LeftRenames(leftRenames)
587
580
, RightRenames(rightRenames)
588
- , LeftPacker(std::make_unique<TGraceJoinPacker>(leftColumnsTypes, leftKeyColumns, ctx.HolderFactory, (anyJoinSettings == EAnyJoinSettings::Left || anyJoinSettings == EAnyJoinSettings::Both || joinKind == EJoinKind::RightSemi || joinKind == EJoinKind::RightOnly), logger, logComponent ))
589
- , RightPacker(std::make_unique<TGraceJoinPacker>(rightColumnsTypes, rightKeyColumns, ctx.HolderFactory, (anyJoinSettings == EAnyJoinSettings::Right || anyJoinSettings == EAnyJoinSettings::Both || joinKind == EJoinKind::LeftSemi || joinKind == EJoinKind::LeftOnly), logger, logComponent ))
590
- , JoinedTablePtr(std::make_unique<GraceJoin::TTable>(logger, logComponent ))
581
+ , LeftPacker(std::make_unique<TGraceJoinPacker>(leftColumnsTypes, leftKeyColumns, ctx.HolderFactory, (anyJoinSettings == EAnyJoinSettings::Left || anyJoinSettings == EAnyJoinSettings::Both || joinKind == EJoinKind::RightSemi || joinKind == EJoinKind::RightOnly)))
582
+ , RightPacker(std::make_unique<TGraceJoinPacker>(rightColumnsTypes, rightKeyColumns, ctx.HolderFactory, (anyJoinSettings == EAnyJoinSettings::Right || anyJoinSettings == EAnyJoinSettings::Both || joinKind == EJoinKind::LeftSemi || joinKind == EJoinKind::LeftOnly)))
583
+ , JoinedTablePtr(std::make_unique<GraceJoin::TTable>())
591
584
, JoinCompleted(std::make_unique<bool >(false ))
592
585
, PartialJoinCompleted(std::make_unique<bool >(false ))
593
586
, HaveMoreLeftRows(std::make_unique<bool >(true ))
594
587
, HaveMoreRightRows(std::make_unique<bool >(true ))
595
588
, IsSelfJoin_(isSelfJoin)
596
589
, SelfJoinSameKeys_(isSelfJoin && (leftKeyColumns == rightKeyColumns))
597
590
, IsSpillingAllowed(isSpillingAllowed)
598
- , Logger(logger)
599
- , LogComponent(logComponent)
600
591
{
601
- UDF_LOG (Logger, LogComponent, GRACEJOIN_DEBUG, TStringBuilder ( ) << (const void *)&*JoinedTablePtr << " # AnyJoinSettings=" << (int )anyJoinSettings << " JoinKind=" << (int )joinKind) ;
592
+ YQL_LOG ( GRACEJOIN_DEBUG) << (const void *)&*JoinedTablePtr << " # AnyJoinSettings=" << (int )anyJoinSettings << " JoinKind=" << (int )joinKind;
602
593
if (IsSelfJoin_) {
603
594
LeftPacker->BatchSize = std::numeric_limits<ui64>::max ();
604
595
RightPacker->BatchSize = std::numeric_limits<ui64>::max ();
@@ -655,23 +646,20 @@ class TGraceJoinSpillingSupportState : public TComputationValue<TGraceJoinSpilli
655
646
LogMemoryUsage ();
656
647
switch (mode) {
657
648
case EOperatingMode::InMemory: {
658
- UDF_LOG (Logger, LogComponent, NUdf::ELogLevel::Info, TStringBuilder ()
659
- << (const void *)&*JoinedTablePtr << " # switching Memory mode to InMemory" );
649
+ YQL_LOG (INFO) << (const void *)&*JoinedTablePtr << " # switching Memory mode to InMemory" ;
660
650
MKQL_ENSURE (false , " Internal logic error" );
661
651
break ;
662
652
}
663
653
case EOperatingMode::Spilling: {
664
- UDF_LOG (Logger, LogComponent, NUdf::ELogLevel::Info, TStringBuilder ()
665
- << (const void *)&*JoinedTablePtr << " # switching Memory mode to Spilling" );
654
+ YQL_LOG (INFO) << (const void *)&*JoinedTablePtr << " # switching Memory mode to Spilling" ;
666
655
MKQL_ENSURE (EOperatingMode::InMemory == Mode, " Internal logic error" );
667
656
auto spiller = ctx.SpillerFactory ->CreateSpiller ();
668
657
RightPacker->TablePtr ->InitializeBucketSpillers (spiller);
669
658
LeftPacker->TablePtr ->InitializeBucketSpillers (spiller);
670
659
break ;
671
660
}
672
661
case EOperatingMode::ProcessSpilled: {
673
- UDF_LOG (Logger, LogComponent, NUdf::ELogLevel::Info, TStringBuilder ()
674
- << (const void *)&*JoinedTablePtr << " # switching Memory mode to ProcessSpilled" );
662
+ YQL_LOG (INFO) << (const void *)&*JoinedTablePtr << " # switching Memory mode to ProcessSpilled" ;
675
663
SpilledBucketsJoinOrder.reserve (GraceJoin::NumberOfBuckets);
676
664
for (ui32 i = 0 ; i < GraceJoin::NumberOfBuckets; ++i) SpilledBucketsJoinOrder.push_back (i);
677
665
@@ -808,11 +796,6 @@ class TGraceJoinSpillingSupportState : public TComputationValue<TGraceJoinSpilli
808
796
}
809
797
810
798
void LogMemoryUsage () const {
811
- const auto memoryUsageLogLevel = NUdf::ELogLevel::Info;
812
- if (!Logger->IsActive (LogComponent, memoryUsageLogLevel)) {
813
- return ;
814
- }
815
-
816
799
const auto used = TlsAllocState->GetUsed ();
817
800
const auto limit = TlsAllocState->GetLimit ();
818
801
TStringBuilder logmsg;
@@ -822,7 +805,7 @@ class TGraceJoinSpillingSupportState : public TComputationValue<TGraceJoinSpilli
822
805
}
823
806
logmsg << (used/1_MB) << " MB/" << (limit/1_MB) << " MB" ;
824
807
825
- UDF_LOG (Logger, LogComponent, memoryUsageLogLevel, logmsg) ;
808
+ YQL_LOG (INFO) << logmsg;
826
809
}
827
810
828
811
EFetchResult DoCalculateInMemory (TComputationContext& ctx, NUdf::TUnboxedValue*const * output) {
@@ -874,10 +857,11 @@ class TGraceJoinSpillingSupportState : public TComputationValue<TGraceJoinSpilli
874
857
(!*HaveMoreRightRows && (!*HaveMoreLeftRows || LeftPacker->TuplesBatchPacked >= LeftPacker->BatchSize )) ||
875
858
(!*HaveMoreLeftRows && RightPacker->TuplesBatchPacked >= RightPacker->BatchSize ))) {
876
859
877
- UDF_LOG (Logger, LogComponent, GRACEJOIN_TRACE, TStringBuilder ( )
860
+ YQL_LOG ( GRACEJOIN_TRACE)
878
861
<< (const void *)&*JoinedTablePtr << ' #'
879
862
<< " HaveLeft " << *HaveMoreLeftRows << " LeftPacked " << LeftPacker->TuplesBatchPacked << " LeftBatch " << LeftPacker->BatchSize
880
- << " HaveRight " << *HaveMoreRightRows << " RightPacked " << RightPacker->TuplesBatchPacked << " RightBatch " << RightPacker->BatchSize );
863
+ << " HaveRight " << *HaveMoreRightRows << " RightPacked " << RightPacker->TuplesBatchPacked << " RightBatch " << RightPacker->BatchSize
864
+ ;
881
865
882
866
auto & leftTable = *LeftPacker->TablePtr ;
883
867
auto & rightTable = SelfJoinSameKeys_ ? *LeftPacker->TablePtr : *RightPacker->TablePtr ;
@@ -1064,9 +1048,6 @@ EFetchResult ProcessSpilledData(TComputationContext&, NUdf::TUnboxedValue*const*
1064
1048
NYql::NUdf::TCounter CounterOutputRows_;
1065
1049
ui32 SpilledBucketsJoinOrderCurrentIndex = 0 ;
1066
1050
std::vector<ui32> SpilledBucketsJoinOrder;
1067
-
1068
- const NUdf::TLoggerPtr Logger;
1069
- const NUdf::TLogComponentId LogComponent;
1070
1051
};
1071
1052
1072
1053
class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode <TGraceJoinWrapper> {
@@ -1186,14 +1167,10 @@ class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode<TGraceJoinWr
1186
1167
}
1187
1168
1188
1169
void MakeSpillingSupportState (TComputationContext& ctx, NUdf::TUnboxedValue& state) const {
1189
- NYql::NUdf::TLoggerPtr logger = ctx.MakeLogger ();
1190
- NYql::NUdf::TLogComponentId logComponent = logger->RegisterComponent (" GraceJoin" );
1191
- UDF_LOG (logger, logComponent, NUdf::ELogLevel::Debug, TStringBuilder () << " State initialized" );
1192
-
1193
1170
state = ctx.HolderFactory .Create <TGraceJoinSpillingSupportState>(
1194
1171
FlowLeft, FlowRight, JoinKind, AnyJoinSettings_, LeftKeyColumns, RightKeyColumns,
1195
1172
LeftRenames, RightRenames, LeftColumnsTypes, RightColumnsTypes,
1196
- ctx, IsSelfJoin_, IsSpillingAllowed, logger, logComponent );
1173
+ ctx, IsSelfJoin_, IsSpillingAllowed);
1197
1174
}
1198
1175
1199
1176
IComputationWideFlowNode *const FlowLeft;
0 commit comments