Skip to content

Commit 2202202

Browse files
authored
Implement HashV2 and allow to choose it from config (#21391)
1 parent 0a04367 commit 2202202

File tree

97 files changed

+369
-319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+369
-319
lines changed

ydb/core/kqp/compile_service/kqp_compile_actor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,15 @@ void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConf
670670
kqpConfig.YqlCoreOptimizerFlags.insert("fuseequijoinsinputmultilabels");
671671
kqpConfig.YqlCoreOptimizerFlags.insert("pullupflatmapoverjoinmultiplelabels");
672672
}
673+
674+
switch(serviceConfig.GetDefaultHashShuffleFuncType()) {
675+
case NKikimrConfig::TTableServiceConfig_EHashKind_HASH_V1:
676+
kqpConfig.DefaultHashShuffleFuncType = NYql::NDq::EHashShuffleFuncType::HashV1;
677+
break;
678+
case NKikimrConfig::TTableServiceConfig_EHashKind_HASH_V2:
679+
kqpConfig.DefaultHashShuffleFuncType = NYql::NDq::EHashShuffleFuncType::HashV2;
680+
break;
681+
}
673682
}
674683

675684
IActor* CreateKqpCompileActor(const TActorId& owner, const TKqpSettings::TConstPtr& kqpSettings,

ydb/core/kqp/executer_actor/kqp_executer_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,6 @@ class TKqpExecuterBase : public TActor<TDerived> {
18441844
Y_ENSURE(hashByShardId.contains(readInfo.ShardId));
18451845
(*columnShardHashV1Params.TaskIndexByHash)[hashByShardId[readInfo.ShardId]] = stageInternalTaskId;
18461846
}
1847-
18481847
}
18491848
}
18501849

ydb/core/kqp/executer_actor/kqp_tasks_graph.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,10 @@ void BuildKqpStageChannels(TKqpTasksGraph& tasksGraph, TStageInfo& stageInfo,
506506
hashKind = EHashShuffleFuncType::HashV1;
507507
break;
508508
}
509+
case NKqpProto::TKqpPhyCnHashShuffle::kHashV2: {
510+
hashKind = EHashShuffleFuncType::HashV2;
511+
break;
512+
}
509513
case NKqpProto::TKqpPhyCnHashShuffle::kColumnShardHashV1: {
510514
Y_ENSURE(enableShuffleElimination, "OptShuffleElimination wasn't turned on, but ColumnShardHashV1 detected!");
511515

@@ -1083,6 +1087,10 @@ void FillOutputDesc(
10831087
hashPartitionDesc.MutableHashV1();
10841088
break;
10851089
}
1090+
case HashV2: {
1091+
hashPartitionDesc.MutableHashV2();
1092+
break;
1093+
}
10861094
case ColumnShardHashV1: {
10871095
auto& columnShardHashV1Params = stageInfo.Meta.GetColumnShardHashV1Params(outputIdx);
10881096
LOG_DEBUG_S(

ydb/core/kqp/query_compiler/kqp_query_compiler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,10 @@ class TKqpQueryCompiler : public IKqpQueryCompiler {
14761476
shuffleProto.MutableHashV1();
14771477
break;
14781478
}
1479+
case HashV2: {
1480+
shuffleProto.MutableHashV2();
1481+
break;
1482+
}
14791483
case ColumnShardHashV1: {
14801484
auto& columnHashV1 = *shuffleProto.MutableColumnShardHashV1();
14811485

ydb/core/protos/kqp_physical.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ message TKqpPhyCnMap {
252252
message THashV1 {
253253
}
254254

255+
message THashV2 {
256+
}
257+
255258
message TColumnShardHashV1 {
256259
repeated uint32 KeyColumnTypes = 3;
257260
}
@@ -261,6 +264,7 @@ message TKqpPhyCnHashShuffle {
261264

262265
oneof HashKind {
263266
THashV1 HashV1 = 2;
267+
THashV2 HashV2 = 5;
264268
TColumnShardHashV1 ColumnShardHashV1 = 3;
265269
}
266270

ydb/core/protos/table_service_config.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,11 @@ message TTableServiceConfig {
396396
optional bool EnableOlapPushdownProjections = 91 [ default = true ];
397397

398398
optional uint32 DefaultLangVer = 92 [default = 202501];
399+
400+
enum EHashKind {
401+
HASH_V1 = 0;
402+
HASH_V2 = 1;
403+
}
404+
405+
optional EHashKind DefaultHashShuffleFuncType = 93 [ default = HASH_V2 ];
399406
};

ydb/library/yql/dq/common/dq_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ enum class EEnabledSpillingNodes : ui64 {
101101

102102
enum class EHashShuffleFuncType {
103103
HashV1 = 0 /* "HashV1" */,
104+
HashV2 = 2 /* "HashV2" */,
104105
ColumnShardHashV1 = 1 /* "ColumnShardHashV1" */,
105106
};
106107

ydb/library/yql/dq/proto/dq_tasks.proto

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ message TTaskOutputBroadcast {
136136
message THashV1 {
137137
}
138138

139+
message THashV2 {
140+
}
141+
139142
message TColumnShardHashV1 {
140143
uint64 ShardCount = 1;
141144
repeated uint64 TaskIndexByHash = 2;
@@ -146,8 +149,9 @@ message TTaskOutputHashPartition {
146149
repeated string KeyColumns = 1;
147150
uint32 PartitionsCount = 2;
148151

149-
oneof THashKind {
152+
oneof HashKind {
150153
THashV1 HashV1 = 3;
154+
THashV2 HashV2 = 5;
151155
TColumnShardHashV1 ColumnShardHashV1 = 4;
152156
}
153157
}

0 commit comments

Comments
 (0)