Skip to content

Commit 658689d

Browse files
authored
Fix HasValue misuse for computation node state (#8555)
1 parent ba6d934 commit 658689d

18 files changed

+32
-32
lines changed

ydb/library/yql/minikql/comp_nodes/mkql_block_agg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TBlockCombineAllWrap
752752
}
753753

754754
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
755-
if (!state.HasValue()) {
755+
if (state.IsInvalid()) {
756756
MakeState(state, ctx);
757757

758758
auto& s = *static_cast<TState*>(state.AsBoxed().Get());
@@ -1638,7 +1638,7 @@ class THashedWrapperBase : public TStatefulWideFlowCodegeneratorNode<TDerived>,
16381638
}
16391639

16401640
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
1641-
if (!state.HasValue()) {
1641+
if (state.IsInvalid()) {
16421642
MakeState(state, ctx);
16431643

16441644
auto& s = *static_cast<TState*>(state.AsBoxed().Get());

ydb/library/yql/minikql/comp_nodes/mkql_block_compress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TCompressBlocks>;
655655
}
656656

657657
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
658-
if (!state.HasValue())
658+
if (state.IsInvalid())
659659
MakeState(ctx, state);
660660
return *static_cast<TState*>(state.AsBoxed().Get());
661661
}

ydb/library/yql/minikql/comp_nodes/mkql_block_map_join.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ using TState = TBlockJoinState<RightRequired>;
247247
}
248248

249249
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
250-
if (!state.HasValue()) {
250+
if (state.IsInvalid()) {
251251
MakeState(ctx, state);
252252
}
253253
return *static_cast<TState*>(state.AsBoxed().Get());

ydb/library/yql/minikql/comp_nodes/mkql_block_top.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ using TChunkedArrayIndex = std::vector<IArrayBuilder::TArrayDataItem>;
575575
}
576576

577577
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
578-
if (!state.HasValue()) {
578+
if (state.IsInvalid()) {
579579
std::vector<bool> dirs(Directions_.size());
580580
std::transform(Directions_.cbegin(), Directions_.cend(), dirs.begin(), [&ctx](IComputationNode* dir){ return dir->GetValue(ctx).Get<bool>(); });
581581

ydb/library/yql/minikql/comp_nodes/mkql_blocks.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TWideToBlocksWrapper
355355
}
356356

357357
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
358-
if (!state.HasValue())
358+
if (state.IsInvalid())
359359
MakeState(ctx, state);
360360
return *static_cast<TState*>(state.AsBoxed().Get());
361361
}
@@ -506,7 +506,7 @@ using TBaseComputation = TStatefulFlowCodegeneratorNode<TFromBlocksWrapper>;
506506
}
507507

508508
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
509-
if (!state.HasValue())
509+
if (state.IsInvalid())
510510
MakeState(ctx, state);
511511
return *static_cast<TState*>(state.AsBoxed().Get());
512512
}
@@ -786,7 +786,7 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TWideFromBlocksWrapp
786786
}
787787

788788
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
789-
if (!state.HasValue()) {
789+
if (state.IsInvalid()) {
790790
MakeState(ctx, state);
791791

792792
const auto s = static_cast<TState*>(state.AsBoxed().Get());
@@ -1132,7 +1132,7 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TBlockExpandChunkedW
11321132
}
11331133

11341134
TBlockState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
1135-
if (!state.HasValue()) {
1135+
if (state.IsInvalid()) {
11361136
MakeState(ctx, state);
11371137

11381138
auto& s = *static_cast<TBlockState*>(state.AsBoxed().Get());

ydb/library/yql/minikql/comp_nodes/mkql_combine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class TCombineCoreFlowWrapper: public std::conditional_t<IsMultiRowState,
176176
{}
177177

178178
NUdf::TUnboxedValuePod DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
179-
if (!state.HasValue()) {
179+
if (state.IsInvalid()) {
180180
MakeState(ctx, state);
181181
}
182182

ydb/library/yql/minikql/comp_nodes/mkql_extend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ using TBaseComputation = TStatefulWideFlowCodegeneratorNode<TExtendWideFlowWrapp
210210
}
211211

212212
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
213-
if (!state.HasValue())
213+
if (state.IsInvalid())
214214
MakeState(ctx, state);
215215
return *static_cast<TState*>(state.AsBoxed().Get());
216216
}
@@ -327,7 +327,7 @@ class TExtendFlowWrapper : public TStatefulFlowCodegeneratorNode<TExtendFlowWrap
327327
}
328328

329329
TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
330-
if (!state.HasValue())
330+
if (state.IsInvalid())
331331
MakeState(ctx, state);
332332
return *static_cast<TState*>(state.AsBoxed().Get());
333333
}

ydb/library/yql/minikql/comp_nodes/mkql_flow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ using TBaseComputation = TWideFlowSourceCodegeneratorNode<TToWideFlowWrapper>;
296296
{}
297297

298298
EFetchResult DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const {
299-
if (!state.HasValue()) {
299+
if (state.IsInvalid()) {
300300
state = Stream->GetValue(ctx);
301301
}
302302

ydb/library/yql/minikql/comp_nodes/mkql_grace_join.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ class TGraceJoinWrapper : public TStatefulWideFlowCodegeneratorNode<TGraceJoinWr
10351035
{}
10361036

10371037
EFetchResult DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const {
1038-
if (!state.HasValue()) {
1038+
if (state.IsInvalid()) {
10391039
MakeSpillingSupportState(ctx, state);
10401040
}
10411041

ydb/library/yql/minikql/comp_nodes/mkql_join.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ class TCommonJoinCoreWrapper : public TStatefulFlowComputationNode<TCommonJoinCo
707707
}
708708

709709
NUdf::TUnboxedValue DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx) const {
710-
if (!state.HasValue()) {
710+
if (state.IsInvalid()) {
711711
state = ctx.HolderFactory.Create<TValue>(ctx, this);
712712
}
713713

@@ -1150,7 +1150,7 @@ class TWideCommonJoinCoreWrapper : public TStatefulWideFlowCodegeneratorNode<TWi
11501150
{}
11511151

11521152
EFetchResult DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const {
1153-
if (!state.HasValue()) {
1153+
if (state.IsInvalid()) {
11541154
MakeState(ctx, state);
11551155
}
11561156

0 commit comments

Comments
 (0)