Skip to content

Commit fb7f1f5

Browse files
authored
[KQP] Add KqpTypeAnnotation for KqpOptPhy. (#22614)
1 parent 8b7713d commit fb7f1f5

File tree

8 files changed

+11
-15
lines changed

8 files changed

+11
-15
lines changed

ydb/core/kqp/host/kqp_host_impl.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,6 @@ TAutoPtr<NYql::IGraphTransformer> CreateKqpExplainPreparedTransformer(TIntrusive
270270
const TString& cluster, TIntrusivePtr<TKqlTransformContext> transformCtx, const NMiniKQL::IFunctionRegistry* funcRegistry,
271271
NYql::TTypeAnnotationContext& typeCtx, TIntrusivePtr<NOpt::TKqpOptimizeContext> optimizeCtx);
272272

273-
TAutoPtr<NYql::IGraphTransformer> CreateKqpTypeAnnotationTransformer(const TString& cluster,
274-
TIntrusivePtr<NYql::TKikimrTablesData> tablesData, NYql::TTypeAnnotationContext& typesCtx,
275-
NYql::TKikimrConfiguration::TPtr config);
276-
277-
TAutoPtr<NYql::IGraphTransformer> CreateKqpCheckQueryTransformer();
278-
279273
TIntrusivePtr<NYql::IKikimrGateway> CreateKqpGatewayProxy(const TIntrusivePtr<IKqpGateway>& gateway,
280274
const TIntrusivePtr<NYql::TKikimrSessionContext>& sessionCtx, TActorSystem* actorSystem);
281275

ydb/core/kqp/host/kqp_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class TKqpRunner : public IKqpRunner {
313313
.AddIOAnnotation()
314314
.AddTypeAnnotationTransformer(CreateKqpTypeAnnotationTransformer(Cluster, sessionCtx->TablesPtr(),
315315
*typesCtx, Config))
316-
.Add(CreateKqpCheckQueryTransformer(), "CheckKqlQuery")
316+
.Add(NOpt::CreateKqpCheckQueryTransformer(), "CheckKqlQuery")
317317
.AddPostTypeAnnotation(/* forSubgraph */ true)
318318
.AddCommonOptimization()
319319
.Add(CreateKqpConstantFoldingTransformer(OptimizeCtx, *typesCtx, Config), "ConstantFolding")

ydb/core/kqp/host/kqp_statement_rewrite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ namespace {
124124
.AddExpressionEvaluation(funcRegistry)
125125
.AddPreTypeAnnotation()
126126
.AddIOAnnotation()
127-
.AddTypeAnnotationTransformer(CreateKqpTypeAnnotationTransformer(cluster, sessionCtx->TablesPtr(), typeCtx, sessionCtx->ConfigPtr()))
127+
.AddTypeAnnotationTransformer(NOpt::CreateKqpTypeAnnotationTransformer(cluster, sessionCtx->TablesPtr(), typeCtx, sessionCtx->ConfigPtr()))
128128
.Build(false);
129129

130130
return TPrepareRewriteInfo{

ydb/core/kqp/host/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ SRCS(
77
kqp_runner.cpp
88
kqp_transform.cpp
99
kqp_translate.cpp
10-
kqp_type_ann.cpp
1110
kqp_statement_rewrite.cpp
1211
)
1312

ydb/core/kqp/opt/kqp_opt.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,9 @@ TAutoPtr<NYql::IGraphTransformer> CreateKqpBuildPhysicalQueryTransformer(const T
108108

109109
TAutoPtr<NYql::IGraphTransformer> CreateKqpQueryBlocksTransformer(TAutoPtr<NYql::IGraphTransformer> queryBlockTransformer);
110110

111+
TAutoPtr<NYql::IGraphTransformer> CreateKqpTypeAnnotationTransformer(const TString& cluster,
112+
TIntrusivePtr<NYql::TKikimrTablesData> tablesData, NYql::TTypeAnnotationContext& typesCtx, NYql::TKikimrConfiguration::TPtr config);
113+
114+
TAutoPtr<NYql::IGraphTransformer> CreateKqpCheckQueryTransformer();
115+
111116
} // namespace NKikimr::NKqp::NOpt

ydb/core/kqp/opt/kqp_opt_build_txs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ class TKqpBuildTxsTransformer : public TSyncTransformerBase {
504504
.Add(*TypeAnnTransformer, "TypeAnnotation")
505505
.AddPostTypeAnnotation(/* forSubgraph */ true)
506506
.Add(CreateKqpBuildPhyStagesTransformer(config->EnableSpilling, typesCtx, config->BlockChannelsMode), "BuildPhysicalStages")
507-
.Add(CreateKqpPhyOptTransformer(kqpCtx, typesCtx, config, nullptr), "KqpPhysicalOptimize")
507+
.Add(CreateKqpPhyOptTransformer(kqpCtx, typesCtx, config,
508+
CreateTypeAnnotationTransformer(CreateKqpTypeAnnotationTransformer(kqpCtx->Cluster, kqpCtx->Tables, typesCtx, config), typesCtx)), "KqpPhysicalOptimize")
508509
// TODO(ilezhankin): "BuildWideBlockChannels" transformer is required only for BLOCK_CHANNELS_FORCE mode.
509510
.Add(CreateKqpBuildWideBlockChannelsTransformer(typesCtx, config->BlockChannelsMode), "BuildWideBlockChannels")
510511
.Add(*BuildTxTransformer, "BuildPhysicalTx")

ydb/core/kqp/host/kqp_type_ann.cpp renamed to ydb/core/kqp/opt/kqp_type_ann.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include "kqp_host_impl.h"
2-
31
#include <ydb/core/kqp/common/kqp_yql.h>
42
#include <ydb/core/kqp/provider/yql_kikimr_provider_impl.h>
53

@@ -12,8 +10,7 @@
1210

1311
#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
1412

15-
namespace NKikimr {
16-
namespace NKqp {
13+
namespace NKikimr::NKqp::NOpt {
1714

1815
using namespace NYql;
1916
using namespace NYql::NDq;
@@ -2438,5 +2435,4 @@ TAutoPtr<IGraphTransformer> CreateKqpCheckQueryTransformer() {
24382435
});
24392436
}
24402437

2441-
} // namespace NKqp
24422438
} // namespace NKikimr

ydb/core/kqp/opt/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SRCS(
1515
kqp_column_statistics_requester.cpp
1616
kqp_constant_folding_transformer.cpp
1717
kqp_opt_hash_func_propagate_transformer.cpp
18+
kqp_type_ann.cpp
1819
)
1920

2021
PEERDIR(

0 commit comments

Comments
 (0)