Skip to content

Commit 898a9ff

Browse files
authored
Enable auto-block mode by default (#7567)
1 parent b569c23 commit 898a9ff

File tree

557 files changed

+1331
-1347
lines changed

Some content is hidden

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

557 files changed

+1331
-1347
lines changed

ydb/core/kqp/opt/kqp_query_plan.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,10 @@ class TxPlanSerializer {
467467
if (!TryFromString(wideColumnName, idx)) {
468468
return wideColumnName;
469469
}
470+
471+
YQL_ENSURE(idx < settings.OutputNarrowType->GetSize(),
472+
"Failed to lookup column name for index " << idx << " in type " << settings.OutputNarrowType->ToString());
473+
470474
return TString(settings.OutputNarrowType->GetItems()[idx]->GetName());
471475
};
472476

ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,6 @@ bool CanPropagateWideBlockThroughChannel(
283283
return false;
284284
}
285285

286-
auto outputItemType = program.Lambda().Ref().GetTypeAnn()->Cast<TStreamExprType>()->GetItemType();
287-
if (IsWideBlockType(*outputItemType)) {
288-
// output is already wide block
289-
return false;
290-
}
291-
292286
if (!stageSettings.WideChannels) {
293287
return false;
294288
}
@@ -306,6 +300,15 @@ bool CanPropagateWideBlockThroughChannel(
306300
return false;
307301
}
308302

303+
auto typeAnnotation = program.Lambda().Ref().GetTypeAnn();
304+
305+
YQL_ENSURE(typeAnnotation, "Program for stage " << output.Stage().Ref().UniqueId() << " doesn't have type annotation");
306+
307+
if (IsWideBlockType(*typeAnnotation->Cast<TStreamExprType>()->GetItemType())) {
308+
// output is already wide block
309+
return false;
310+
}
311+
309312
return true;
310313
}
311314

@@ -445,8 +448,6 @@ TMaybeNode<TKqpPhysicalTx> PeepholeOptimize(const TKqpPhysicalTx& tx, TExprConte
445448
.ArgsType(ExpandType(stage.Pos(), *ctx.MakeType<TTupleExprType>(argTypes), ctx))
446449
.Done();
447450

448-
YQL_ENSURE(programs.emplace(stage.Ref().UniqueId(), program).second);
449-
450451
const bool allowNonDeterministicFunctions = !program.Lambda().Body().Maybe<TKqpEffects>();
451452

452453
TExprNode::TPtr newProgram;
@@ -468,7 +469,7 @@ TMaybeNode<TKqpPhysicalTx> PeepholeOptimize(const TKqpPhysicalTx& tx, TExprConte
468469
}
469470

470471
optimizedStages.emplace(stage.Ref().UniqueId());
471-
programs.at(stage.Ref().UniqueId()) = TKqpProgram(newProgram);
472+
YQL_ENSURE(programs.emplace(stage.Ref().UniqueId(), TKqpProgram(newProgram)).second);
472473
}
473474

474475
TVector<TKqpParamBinding> bindings(tx.ParamBindings().begin(), tx.ParamBindings().end());

ydb/core/kqp/ut/query/kqp_limits_ut.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ Y_UNIT_TEST_SUITE(KqpLimits) {
10451045

10461046
UNIT_ASSERT_VALUES_EQUAL(plan["Plan"]["Node Type"].GetStringSafe(), "Query");
10471047
UNIT_ASSERT_VALUES_EQUAL(plan["Plan"]["Plans"][0]["Node Type"].GetStringSafe(), "ResultSet");
1048-
UNIT_ASSERT_VALUES_EQUAL(plan["Plan"]["Plans"][0]["Plans"][0]["Node Type"].GetStringSafe(), "Collect");
1048+
UNIT_ASSERT_VALUES_EQUAL(plan["Plan"]["Plans"][0]["Plans"][0]["Node Type"].GetStringSafe(), "Stage");
10491049
UNIT_ASSERT_VALUES_EQUAL(plan["Plan"]["Plans"][0]["Plans"][0]["Plans"][0]["Node Type"].GetStringSafe(), "Merge");
10501050
UNIT_ASSERT_VALUES_EQUAL(plan["Plan"]["Plans"][0]["Plans"][0]["Plans"][0]["SortColumns"].GetArraySafe()[0], "Key (Asc)");
10511051

ydb/core/protos/table_service_config.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ message TTableServiceConfig {
289289
BLOCK_CHANNELS_AUTO = 1;
290290
BLOCK_CHANNELS_FORCE = 2;
291291
}
292-
optional EBlockChannelsMode BlockChannelsMode = 61 [default = BLOCK_CHANNELS_SCALAR];
292+
optional EBlockChannelsMode BlockChannelsMode = 61 [default = BLOCK_CHANNELS_AUTO];
293293

294294
optional uint64 QueryReplayCacheUploadTTLSec = 62 [default = 36000];
295295

ydb/tests/functional/canonical/canondata/test_sql.TestCanonicalFolder1.test_case_join_group_by_lookup.script-script_/join_group_by_lookup.script.plan

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"Operators": [
7474
{
7575
"Inputs": [],
76-
"Iterator": "precompute_0_0",
77-
"Name": "Iterator"
76+
"Name": "ToFlow",
77+
"ToFlow": "precompute_0_0"
7878
}
7979
],
8080
"PlanNodeId": 16
@@ -87,7 +87,7 @@
8787
"PlanNodeType": "Connection",
8888
"Plans": [
8989
{
90-
"Node Type": "Collect",
90+
"Node Type": "Stage",
9191
"PlanNodeId": 14,
9292
"Plans": [
9393
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_coalesce-and-join.test_/query_1.plan

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"Operators": [
6868
{
6969
"Inputs": [],
70-
"Iterator": "precompute_2_0",
71-
"Name": "Iterator"
70+
"Name": "ToFlow",
71+
"ToFlow": "precompute_2_0"
7272
}
7373
],
7474
"PlanNodeId": 28
@@ -81,7 +81,7 @@
8181
"PlanNodeType": "Connection",
8282
"Plans": [
8383
{
84-
"Node Type": "Collect",
84+
"Node Type": "Stage",
8585
"PlanNodeId": 26,
8686
"Plans": [
8787
{
@@ -207,8 +207,8 @@
207207
"Operators": [
208208
{
209209
"Inputs": [],
210-
"Iterator": "precompute_0_0",
211-
"Name": "Iterator"
210+
"Name": "ToFlow",
211+
"ToFlow": "precompute_0_0"
212212
}
213213
],
214214
"PlanNodeId": 14
@@ -221,7 +221,7 @@
221221
"PlanNodeType": "Connection",
222222
"Plans": [
223223
{
224-
"Node Type": "Collect",
224+
"Node Type": "Stage",
225225
"PlanNodeId": 12,
226226
"Plans": [
227227
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_coalesce-and-join.test_/query_2.plan

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"Operators": [
6868
{
6969
"Inputs": [],
70-
"Iterator": "precompute_0_0",
71-
"Name": "Iterator"
70+
"Name": "ToFlow",
71+
"ToFlow": "precompute_0_0"
7272
}
7373
],
7474
"PlanNodeId": 14
@@ -81,7 +81,7 @@
8181
"PlanNodeType": "Connection",
8282
"Plans": [
8383
{
84-
"Node Type": "Collect",
84+
"Node Type": "Stage",
8585
"PlanNodeId": 12,
8686
"Plans": [
8787
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_coalesce-and-join.test_/query_3.plan

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"Operators": [
6868
{
6969
"Inputs": [],
70-
"Iterator": "precompute_0_0",
71-
"Name": "Iterator"
70+
"Name": "ToFlow",
71+
"ToFlow": "precompute_0_0"
7272
}
7373
],
7474
"PlanNodeId": 14
@@ -81,7 +81,7 @@
8181
"PlanNodeType": "Connection",
8282
"Plans": [
8383
{
84-
"Node Type": "Collect",
84+
"Node Type": "Stage",
8585
"PlanNodeId": 12,
8686
"Plans": [
8787
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_coalesce-and-join.test_/query_4.plan

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"Operators": [
6868
{
6969
"Inputs": [],
70-
"Iterator": "precompute_0_0",
71-
"Name": "Iterator"
70+
"Name": "ToFlow",
71+
"ToFlow": "precompute_0_0"
7272
}
7373
],
7474
"PlanNodeId": 14
@@ -81,7 +81,7 @@
8181
"PlanNodeType": "Connection",
8282
"Plans": [
8383
{
84-
"Node Type": "Collect",
84+
"Node Type": "Stage",
8585
"PlanNodeId": 12,
8686
"Plans": [
8787
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_coalesce-and-join.test_/query_5.plan

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"PlanNodeType": "Connection",
6363
"Plans": [
6464
{
65-
"Node Type": "Collect",
65+
"Node Type": "Stage",
6666
"PlanNodeId": 4,
6767
"Plans": [
6868
{
@@ -111,7 +111,7 @@
111111
"PlanNodeType": "Connection",
112112
"Plans": [
113113
{
114-
"Node Type": "Collect",
114+
"Node Type": "Stage",
115115
"PlanNodeId": 7,
116116
"Plans": [
117117
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join-group-by-with-null.test_/query_2.plan

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
"Operators": [
9292
{
9393
"Inputs": [],
94-
"Iterator": "precompute_0_0",
95-
"Name": "Iterator"
94+
"Name": "ToFlow",
95+
"ToFlow": "precompute_0_0"
9696
}
9797
],
9898
"PlanNodeId": 14
@@ -105,7 +105,7 @@
105105
"PlanNodeType": "Connection",
106106
"Plans": [
107107
{
108-
"Node Type": "Collect",
108+
"Node Type": "Stage",
109109
"PlanNodeId": 12,
110110
"Plans": [
111111
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join-group-by-with-null.test_/query_3.plan

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
"Operators": [
9292
{
9393
"Inputs": [],
94-
"Iterator": "precompute_0_0",
95-
"Name": "Iterator"
94+
"Name": "ToFlow",
95+
"ToFlow": "precompute_0_0"
9696
}
9797
],
9898
"PlanNodeId": 14
@@ -105,7 +105,7 @@
105105
"PlanNodeType": "Connection",
106106
"Plans": [
107107
{
108-
"Node Type": "Collect",
108+
"Node Type": "Stage",
109109
"PlanNodeId": 12,
110110
"Plans": [
111111
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join-group-by-with-null.test_/query_4.plan

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"PlanNodeType": "Connection",
124124
"Plans": [
125125
{
126-
"Node Type": "Collect",
126+
"Node Type": "Stage",
127127
"PlanNodeId": 6,
128128
"Plans": [
129129
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join-group-by-with-null.test_/query_5.plan

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"PlanNodeType": "Connection",
133133
"Plans": [
134134
{
135-
"Node Type": "Collect",
135+
"Node Type": "Stage",
136136
"PlanNodeId": 4,
137137
"Plans": [
138138
{

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join0.test_/query_1.plan

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"PlanNodeType": "Connection",
6363
"Plans": [
6464
{
65-
"Node Type": "Collect",
65+
"Node Type": "Stage",
6666
"PlanNodeId": 4,
6767
"Plans": [
6868
{
@@ -135,7 +135,7 @@
135135
"PlanNodeType": "Connection",
136136
"Plans": [
137137
{
138-
"Node Type": "Collect",
138+
"Node Type": "Stage",
139139
"PlanNodeId": 7,
140140
"Plans": [
141141
{

0 commit comments

Comments
 (0)