Skip to content

Commit 4da79fb

Browse files
authored
[DQ] Reuse dq validation states (#10222)
1 parent bee0845 commit 4da79fb

File tree

11 files changed

+178
-183
lines changed

11 files changed

+178
-183
lines changed

ydb/library/yql/providers/common/transform/yql_lazy_init.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class TLazyInitHolder
2626
return Value.Get();
2727
}
2828

29+
inline explicit operator bool() const noexcept {
30+
return !!Value.Get();
31+
}
32+
2933
private:
3034
TFactory Factory;
3135
mutable THolder<T> Value;

ydb/library/yql/providers/dq/provider/ya.make

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ PEERDIR(
3535
library/cpp/yson
3636
ydb/public/lib/yson_value
3737
ydb/public/sdk/cpp/client/ydb_driver
38+
ydb/library/yql/ast
3839
ydb/library/yql/core
3940
ydb/library/yql/core/issue
4041
ydb/library/yql/utils/backtrace
@@ -60,6 +61,7 @@ PEERDIR(
6061
ydb/library/yql/providers/dq/actors
6162
ydb/library/yql/providers/result/expr_nodes
6263
ydb/library/yql/minikql
64+
ydb/library/yql/public/issue
6365
)
6466

6567
YQL_LAST_ABI_VERSION()

ydb/library/yql/providers/dq/provider/yql_dq_datasource.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class TDqDataProviderSource: public TDataProviderBase {
5151
, TypeAnnotationTransformer_([] () { return CreateDqsDataSourceTypeAnnotationTransformer(); })
5252
, ConstraintsTransformer_([] () { return CreateDqDataSourceConstraintTransformer(); })
5353
, StatisticsTransformer_([this]() { return CreateDqsStatisticsTransformer(State_, TBaseProviderContext::Instance()); })
54+
, ExecutionValidator_([this]() { return MakeHolder<TDqExecutionValidator>(State_); })
5455
{ }
5556

5657
TStringBuf GetName() const override {
@@ -262,7 +263,7 @@ class TDqDataProviderSource: public TDataProviderBase {
262263
}
263264

264265
bool ValidateExecution(const TExprNode& node, TExprContext& ctx) override {
265-
return ValidateDqExecution(node, *State_->TypeCtx, ctx, State_);
266+
return ExecutionValidator_->ValidateDqExecution(node, ctx);
266267
}
267268

268269
bool CanParse(const TExprNode& node) override {
@@ -276,9 +277,16 @@ class TDqDataProviderSource: public TDataProviderBase {
276277
void Reset() final {
277278
if (ExecTransformer_) {
278279
ExecTransformer_->Rewind();
280+
}
281+
if (TypeAnnotationTransformer_) {
279282
TypeAnnotationTransformer_->Rewind();
283+
}
284+
if (ConstraintsTransformer_) {
280285
ConstraintsTransformer_->Rewind();
281286
}
287+
if (ExecutionValidator_) {
288+
ExecutionValidator_->Rewind();
289+
}
282290
}
283291

284292
private:
@@ -288,6 +296,7 @@ class TDqDataProviderSource: public TDataProviderBase {
288296
TLazyInitHolder<TVisitorTransformerBase> TypeAnnotationTransformer_;
289297
TLazyInitHolder<IGraphTransformer> ConstraintsTransformer_;
290298
TLazyInitHolder<IGraphTransformer> StatisticsTransformer_;
299+
TLazyInitHolder<TDqExecutionValidator> ExecutionValidator_;
291300
};
292301

293302
}

0 commit comments

Comments
 (0)