Skip to content

Commit 47bd121

Browse files
author
Vadim Averin
authored
Allow system sampling in DQ (#7836)
1 parent 4b5d232 commit 47bd121

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

ydb/library/yql/providers/yt/gateway/lib/yt_helpers.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,15 @@ static bool IterateRows(NYT::ITransactionPtr tx,
340340
}
341341

342342
NYT::TTableReaderOptions readerOptions;
343-
if (sampling && sampling->Mode == EYtSampleMode::Bernoulli) {
343+
if (sampling) {
344344
NYT::TNode spec = NYT::TNode::CreateMap();
345345
spec["sampling_rate"] = sampling->Percentage / 100.;
346346
if (sampling->Repeat) {
347347
spec["sampling_seed"] = static_cast<i64>(sampling->Repeat);
348348
}
349+
if (sampling->Mode == EYtSampleMode::System) {
350+
spec["sampling_mode"] = "block";
351+
}
349352
readerOptions.Config(spec);
350353
}
351354

ydb/library/yql/providers/yt/provider/yql_yt_dq_hybrid.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ class TYtDqHybridTransformer : public TOptimizeTransformerBase {
120120
PushSkipStat("NonEmptyKeyFilter", nodeName);
121121
return false;
122122
}
123-
auto sampleSetting = GetSetting(section.Settings().Ref(), EYtSettingType::Sample);
124-
if (sampleSetting && sampleSetting->Child(1)->Child(0)->Content() == "system") {
125-
return false;
126-
}
127123
ui64 dataSize = 0ULL, dataChunks = 0ULL;
128124
for (const auto& path : section.Paths()) {
129125
const TYtPathInfo info(path);

ydb/library/yql/providers/yt/provider/yql_yt_dq_integration.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,6 @@ class TYtDqIntegration: public TDqIntegrationBase {
426426
AddMessage(ctx, info, skipIssues, State_->PassiveExecution);
427427
return false;
428428
}
429-
auto sampleSetting = GetSetting(section.Settings().Ref(), EYtSettingType::Sample);
430-
if (sampleSetting && sampleSetting->Child(1)->Child(0)->Content() == "system") {
431-
AddMessage(ctx, "system sampling", skipIssues, State_->PassiveExecution);
432-
return false;
433-
}
434429
for (auto path: section.Paths()) {
435430
if (!path.Table().Maybe<TYtTable>()) {
436431
AddMessage(ctx, "non-table path", skipIssues, State_->PassiveExecution);

ydb/library/yql/providers/yt/provider/yql_yt_mkql_compiler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,13 @@ TRuntimeNode BuildDqYtInputCall(
395395
// All sections have the same sampling settings
396396
if (samplingSpec.IsUndefined()) {
397397
if (auto sampling = GetSampleParams(section.Settings().Ref())) {
398-
YQL_ENSURE(sampling->Mode != EYtSampleMode::System);
399398
samplingSpec["sampling_rate"] = sampling->Percentage / 100.;
400399
if (sampling->Repeat) {
401400
samplingSpec["sampling_seed"] = static_cast<i64>(sampling->Repeat);
402401
}
402+
if (sampling->Mode == EYtSampleMode::System) {
403+
samplingSpec["sampling_mode"] = "block";
404+
}
403405
}
404406
}
405407
}

0 commit comments

Comments
 (0)