Skip to content

Commit 0d54b2e

Browse files
committed
Change interface
1 parent 0ee2524 commit 0d54b2e

File tree

6 files changed

+11
-19
lines changed

6 files changed

+11
-19
lines changed

ydb/library/yql/core/services/yql_transform_pipeline.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ TTransformationPipeline& TTransformationPipeline::Add(IGraphTransformer& transfo
3939
return *this;
4040
}
4141

42-
TTransformationPipeline& TTransformationPipeline::Add(TTransformStage&& stage) {
43-
Transformers_.push_back(std::move(stage));
44-
return *this;
45-
}
46-
4742
TTransformationPipeline& TTransformationPipeline::AddServiceTransformers(EYqlIssueCode issueCode) {
4843
Transformers_.push_back(TTransformStage(CreateGcNodeTransformer(), "GC", issueCode));
4944
return *this;

ydb/library/yql/core/services/yql_transform_pipeline.h

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class TTransformationPipeline
4747
EYqlIssueCode issueCode = TIssuesIds::DEFAULT_ERROR, const TString& issueMessage = {});
4848
TTransformationPipeline& Add(IGraphTransformer& transformer, const TString& stageName,
4949
EYqlIssueCode issueCode = TIssuesIds::DEFAULT_ERROR, const TString& issueMessage = {});
50-
TTransformationPipeline& Add(TTransformStage&& stage);
5150

5251
TAutoPtr<IGraphTransformer> Build(bool useIssueScopes = true);
5352
TAutoPtr<IGraphTransformer> BuildWithNoArgChecks(bool useIssueScopes = true);

ydb/library/yql/dq/integration/yql_dq_integration.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <ydb/library/yql/ast/yql_expr.h>
44
#include <ydb/library/yql/core/yql_data_provider.h>
5-
#include <ydb/library/yql/core/yql_graph_transformer.h>
65
#include <ydb/library/yql/core/yql_statistics.h>
76
#include <ydb/library/yql/dq/tasks/dq_tasks_graph.h>
87
#include <ydb/library/yql/public/issue/yql_issue.h>
@@ -23,6 +22,7 @@ class TJsonValue;
2322
namespace NYql {
2423

2524
struct TDqSettings;
25+
class TTransformationPipeline;
2626

2727
namespace NCommon {
2828
class TMkqlCallableCompilerBase;
@@ -73,8 +73,8 @@ class IDqIntegration {
7373
// Return true if node was handled
7474
virtual bool FillSourcePlanProperties(const NNodes::TExprBase& node, TMap<TString, NJson::TJsonValue>& properties) = 0;
7575
virtual bool FillSinkPlanProperties(const NNodes::TExprBase& node, TMap<TString, NJson::TJsonValue>& properties) = 0;
76-
// This transformer will be called before DQ peephole transformations
77-
virtual std::vector<TTransformStage> GetPeepholeTransforms(bool beforeDq, const THashMap<TString, TString>& params) = 0;
76+
// Called to configure DQ peephole
77+
virtual void ConfigurePeepholePipeline(bool beforeDqTransforms, const THashMap<TString, TString>& params, TTransformationPipeline* pipeline) = 0;
7878
};
7979

8080
} // namespace NYql

ydb/library/yql/providers/common/dq/yql_dq_integration_impl.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ bool TDqIntegrationBase::FillSinkPlanProperties(const NNodes::TExprBase&, TMap<T
9292
return false;
9393
}
9494

95-
std::vector<TTransformStage> TDqIntegrationBase::GetPeepholeTransforms(bool, const THashMap<TString, TString>&) {
96-
return {};
95+
void TDqIntegrationBase::ConfigurePeepholePipeline(bool, const THashMap<TString, TString>&, TTransformationPipeline*) {
9796
}
9897

9998
} // namespace NYql

ydb/library/yql/providers/common/dq/yql_dq_integration_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TDqIntegrationBase: public IDqIntegration {
2626
void WriteFullResultTableRef(NYson::TYsonWriter& writer, const TVector<TString>& columns, const THashMap<TString, TString>& graphParams) override;
2727
bool FillSourcePlanProperties(const NNodes::TExprBase& node, TMap<TString, NJson::TJsonValue>& properties) override;
2828
bool FillSinkPlanProperties(const NNodes::TExprBase& node, TMap<TString, NJson::TJsonValue>& properties) override;
29-
std::vector<TTransformStage> GetPeepholeTransforms(bool beforeDq, const THashMap<TString, TString>& params) override;
29+
void ConfigurePeepholePipeline(bool beforeDqTransforms, const THashMap<TString, TString>& params, TTransformationPipeline* pipeline) override;
3030

3131
protected:
3232
bool CanBlockReadTypes(const TStructExprType* node);

ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,14 @@ struct TDqsPipelineConfigurator : public IPipelineConfigurator {
243243
void AfterCreate(TTransformationPipeline*) const final {}
244244

245245
void AfterTypeAnnotation(TTransformationPipeline* pipeline) const final {
246+
// First truncate graph by calculated precomputes
247+
pipeline->Add(NDqs::CreateDqsReplacePrecomputesTransformer(*pipeline->GetTypeAnnotationContext(), State_->FunctionRegistry), "ReplacePrecomputes");
248+
249+
// Then apply provider specific transformers on truncated graph
246250
std::for_each(UniqIntegrations_.cbegin(), UniqIntegrations_.cend(), [&](const auto dqInt) {
247-
for (auto& stage: dqInt->GetPeepholeTransforms(true, ProviderParams_)) {
248-
pipeline->Add(std::move(stage));
249-
}
251+
dqInt->ConfigurePeepholePipeline(true, ProviderParams_, pipeline);
250252
});
251253

252-
pipeline->Add(NDqs::CreateDqsReplacePrecomputesTransformer(*pipeline->GetTypeAnnotationContext(), State_->FunctionRegistry), "ReplacePrecomputes");
253254
if (State_->Settings->UseBlockReader.Get().GetOrElse(false)) {
254255
pipeline->Add(NDqs::CreateDqsRewritePhyBlockReadOnDqIntegrationTransformer(*pipeline->GetTypeAnnotationContext()), "ReplaceWideReadsWithBlock");
255256
}
@@ -274,9 +275,7 @@ struct TDqsPipelineConfigurator : public IPipelineConfigurator {
274275

275276
void AfterOptimize(TTransformationPipeline* pipeline) const final {
276277
std::for_each(UniqIntegrations_.cbegin(), UniqIntegrations_.cend(), [&](const auto dqInt) {
277-
for (auto& stage: dqInt->GetPeepholeTransforms(false, ProviderParams_)) {
278-
pipeline->Add(std::move(stage));
279-
}
278+
dqInt->ConfigurePeepholePipeline(false, ProviderParams_, pipeline);
280279
});
281280
}
282281

0 commit comments

Comments
 (0)