Skip to content

Commit

Permalink
Move NamedValues out of QueryInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorkaZ committed Dec 22, 2023
1 parent b84a932 commit fcbc039
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ydb/core/fq/libs/control_plane_storage/internal/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ std::unordered_map<TString, i64> AggregateStatisticsBySources(const NJson::TJson
}
}

void PackStatisticsToProtobuf(google::protobuf::RepeatedPtrField<FederatedQuery::Internal::QueryInternal_NamedValue>& dest, std::string_view statsStr) {
void PackStatisticsToProtobuf(google::protobuf::RepeatedPtrField<FederatedQuery::Internal::StatisticsNamedValue>& dest, std::string_view statsStr) {
NJson::TJsonValue statsJson;
if (!NJson::ReadJsonFastTree(statsStr, &statsJson)) {
return;
Expand Down Expand Up @@ -375,7 +375,7 @@ void PackStatisticsToProtobuf(google::protobuf::RepeatedPtrField<FederatedQuery:
}
}

StatsValuesList ExtractStatisticsFromProtobuf(const google::protobuf::RepeatedPtrField<FederatedQuery::Internal::QueryInternal_NamedValue>& statsProto) {
StatsValuesList ExtractStatisticsFromProtobuf(const google::protobuf::RepeatedPtrField<FederatedQuery::Internal::StatisticsNamedValue>& statsProto) {
StatsValuesList statPairs;
statPairs.reserve(statsProto.size());
for (const auto& stat : statsProto) {
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/fq/libs/control_plane_storage/internal/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ NYql::TIssues ValidateCreateOrDeleteRateLimiterResource(const TString& queryId,
std::vector<TString> GetMeteringRecords(const TString& statistics, bool billable, const TString& jobId, const TString& scope, const TString& sourceId);
TString GetPrettyStatistics(const TString& statistics);

void PackStatisticsToProtobuf(google::protobuf::RepeatedPtrField<FederatedQuery::Internal::QueryInternal_NamedValue>& dest, std::string_view statsStr);
void PackStatisticsToProtobuf(google::protobuf::RepeatedPtrField<FederatedQuery::Internal::StatisticsNamedValue>& dest, std::string_view statsStr);

using StatsValuesList = std::vector<std::pair<TString, ui64>>;

StatsValuesList ExtractStatisticsFromProtobuf(const google::protobuf::RepeatedPtrField<FederatedQuery::Internal::QueryInternal_NamedValue>& statsProto);
StatsValuesList ExtractStatisticsFromProtobuf(const google::protobuf::RepeatedPtrField<FederatedQuery::Internal::StatisticsNamedValue>& statsProto);

struct Statistics {
operator bool() const noexcept { return !Stats.empty(); }
Expand Down
12 changes: 6 additions & 6 deletions ydb/core/fq/libs/control_plane_storage/proto/yq_internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ message Consumer {
string name = 1;
}

message StatisticsNamedValue {
string name = 1;
int64 value = 2;
}

message QueryInternal {
string token = 1;
repeated NYql.NDqProto.TDqTask task = 2; // deprecated and should not be used, will be removed in future
Expand Down Expand Up @@ -50,12 +55,7 @@ message QueryInternal {
NFq.NConfig.TYdbStorageConfig compute_connection = 26;
google.protobuf.Duration result_ttl = 27;
NYql.NDqProto.StatusIds.StatusCode pending_status_code = 28;

message NamedValue {
string name = 1;
int64 value = 2;
}
repeated NamedValue statistics = 29;
repeated StatisticsNamedValue statistics = 29;
}

message JobInternal {
Expand Down

0 comments on commit fcbc039

Please sign in to comment.