summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlirikl31 <[email protected]>2025-03-19 14:28:58 +0300
committerlirikl31 <[email protected]>2025-03-19 14:47:36 +0300
commit33eabfb92a6f9b58c54fe8c4e5ce967066c586da (patch)
treef931a14873633eb80d9d396055ad8153e82134e7
parent3ee871ba22f5e7f8cc530610fad6eb53628774be (diff)
Support offset in YT builder
язык динтаблиц поддерживает offset, добавляю в builder commit_hash:7b24e71291b839b32c8ea8e2474978da2071c445
-rw-r--r--yt/yt/client/query_client/query_builder.cpp9
-rw-r--r--yt/yt/client/query_client/query_builder.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/yt/yt/client/query_client/query_builder.cpp b/yt/yt/client/query_client/query_builder.cpp
index 4cdce715966..dd453632916 100644
--- a/yt/yt/client/query_client/query_builder.cpp
+++ b/yt/yt/client/query_client/query_builder.cpp
@@ -103,6 +103,11 @@ void TQueryBuilder::AddOrderByDescendingExpression(TString expression)
AddOrderByExpression(std::move(expression), EOrderByDirection::Descending);
}
+void TQueryBuilder::SetOffset(i64 offset)
+{
+ Offset_ = offset;
+}
+
void TQueryBuilder::SetLimit(i64 limit)
{
Limit_ = limit;
@@ -177,6 +182,10 @@ TString TQueryBuilder::Build()
parts.push_back(JoinSeq(", ", OrderByEntries_));
}
+ if (Offset_) {
+ parts.push_back(Format("OFFSET %v", *Offset_));
+ }
+
if (Limit_) {
parts.push_back(Format("LIMIT %v", *Limit_));
}
diff --git a/yt/yt/client/query_client/query_builder.h b/yt/yt/client/query_client/query_builder.h
index 56ec58458ab..3cf1e04af30 100644
--- a/yt/yt/client/query_client/query_builder.h
+++ b/yt/yt/client/query_client/query_builder.h
@@ -52,6 +52,7 @@ public:
void AddJoinExpression(TString table, TString alias, TString onExpression, ETableJoinType type);
+ void SetOffset(i64 offset);
void SetLimit(i64 limit);
TString Build();
@@ -87,6 +88,7 @@ private:
EWithTotalsMode WithTotalsMode_ = EWithTotalsMode::None;
std::vector<TString> HavingConjuncts_;
std::vector<TJoinEntry> JoinEntries_;
+ std::optional<i64> Offset_;
std::optional<i64> Limit_;
private: