Skip to content

Commit 94b7494

Browse files
solomon data source plan properties (#23798) (#24061)
1 parent 2910939 commit 94b7494

File tree

2 files changed

+55
-7
lines changed

2 files changed

+55
-7
lines changed

ydb/library/yql/providers/solomon/actors/dq_solomon_read_actor.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,13 @@ class TDqSolomonReadActor : public NActors::TActorBootstrapped<TDqSolomonReadAct
525525
return result;
526526
}
527527

528-
result.reserve(pointsCount / MaxPointsPerOneRequest);
528+
ui64 timeIntervals = ceil(pointsCount * 1.0 / MaxPointsPerOneRequest);
529+
result.reserve(timeIntervals);
529530
auto rangeDuration = to - from;
530-
for (ui64 i = 0; i < pointsCount; i += MaxPointsPerOneRequest) {
531-
double start = i;
532-
double end = std::min(i + MaxPointsPerOneRequest, pointsCount);
531+
for (ui64 i = 0; i < timeIntervals; ++i) {
533532
result.emplace_back(
534-
from + rangeDuration * start / pointsCount,
535-
from + rangeDuration * end / pointsCount
533+
from + rangeDuration * 1.0 / timeIntervals * i,
534+
from + rangeDuration * 1.0 / timeIntervals * (i + 1)
536535
);
537536
}
538537

ydb/library/yql/providers/solomon/provider/yql_solomon_dq_integration.cpp

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ using namespace NNodes;
2323

2424
namespace {
2525

26+
TString GetLastName(const TString& fullName) {
27+
auto n = fullName.find_last_of('/');
28+
return (n == fullName.npos) ? fullName : fullName.substr(n + 1);
29+
}
30+
2631
bool ExtractSettingValue(const TExprNode& value, TStringBuf settingName, TExprContext& ctx, TStringBuf& settingValue) {
2732
if (value.IsAtom()) {
2833
settingValue = value.Content();
@@ -116,7 +121,7 @@ class TSolomonDqIntegration: public TDqIntegrationBase {
116121

117122
auto settings = soReadObject.Object().Settings();
118123
auto& settingsRef = settings.Ref();
119-
TInstant from = TInstant::Now() - TDuration::Hours(1);
124+
TInstant from = TInstant::Zero();
120125
TInstant to = TInstant::Now();
121126
TString program;
122127
TString selectors;
@@ -437,6 +442,50 @@ class TSolomonDqIntegration: public TDqIntegrationBase {
437442
sinkType = "SolomonSink";
438443
}
439444

445+
bool FillSourcePlanProperties(const NNodes::TExprBase& node, TMap<TString, NJson::TJsonValue>& properties) override {
446+
if (!node.Maybe<TDqSource>()) {
447+
return false;
448+
}
449+
450+
auto source = node.Cast<TDqSource>();
451+
const auto maybeSettings = source.Settings().Maybe<TSoSourceSettings>();
452+
if (!maybeSettings) {
453+
return false;
454+
}
455+
456+
const auto settings = maybeSettings.Cast();
457+
const auto& cluster = source.DataSource().Cast<TSoDataSource>().Cluster().StringValue();
458+
const auto* clusterDesc = State_->Configuration->ClusterConfigs.FindPtr(cluster);
459+
460+
properties["ExternalDataSource"] = GetLastName(cluster);
461+
properties["ClusterType"] = clusterDesc->GetClusterType() == TSolomonClusterConfig::SCT_SOLOMON ? "solomon" : "monitoring";
462+
463+
properties["From"] = settings.From().StringValue();
464+
properties["To"] = settings.To().StringValue();
465+
466+
auto selectors = settings.Selectors().StringValue();
467+
if (!selectors.empty()) {
468+
properties["Selectors"] = selectors;
469+
}
470+
471+
auto program = settings.Program().StringValue();
472+
if (!program.empty()) {
473+
properties["Program"] = program;
474+
}
475+
476+
const bool isDisabled = FromString<bool>(settings.DownsamplingDisabled().Literal().Value());
477+
if (!isDisabled) {
478+
properties["DownsamplingDisabled"] = "false";
479+
properties["DownsamplingAggregation"] = settings.DownsamplingAggregation().StringValue();
480+
properties["DownsamplingFill"] = settings.DownsamplingFill().StringValue();
481+
properties["DownsamplingGridInterval"] = settings.DownsamplingGridSec().Literal().Value();
482+
} else {
483+
properties["DownsamplingDisabled"] = "true";
484+
}
485+
486+
return true;
487+
}
488+
440489
void RegisterMkqlCompiler(NCommon::TMkqlCallableCompilerBase& compiler) override {
441490
RegisterDqSolomonMkqlCompilers(compiler);
442491
}

0 commit comments

Comments
 (0)