aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlukyan <lukyan@yandex-team.com>2024-08-07 00:06:52 +0300
committerlukyan <lukyan@yandex-team.com>2024-08-07 00:27:49 +0300
commit028ea52d7f2b0a374ac6492537e44576fc26713f (patch)
tree73c5a8a55bb0dde32a2dcb6667ce7f48fd2b839e
parent53824b7350c60052ccba408ced1643ad0b04ad69 (diff)
downloadydb-028ea52d7f2b0a374ac6492537e44576fc26713f.tar.gz
YT-21484: Do not modify initial inferred ranges
4d1fd9d9c09fa301dcfd1f1e7af394312c9dfa74
-rw-r--r--yt/yt/client/table_client/unversioned_row.cpp23
-rw-r--r--yt/yt/client/table_client/unversioned_row.h10
2 files changed, 24 insertions, 9 deletions
diff --git a/yt/yt/client/table_client/unversioned_row.cpp b/yt/yt/client/table_client/unversioned_row.cpp
index e3303daaf4..23878fea57 100644
--- a/yt/yt/client/table_client/unversioned_row.cpp
+++ b/yt/yt/client/table_client/unversioned_row.cpp
@@ -2083,18 +2083,23 @@ TUnversionedValueRange ToKeyRef(TUnversionedRow row, int prefixLength)
////////////////////////////////////////////////////////////////////////////////
+void FormatValue(TStringBuilderBase* builder, TUnversionedValueRange values, TStringBuf format)
+{
+ builder->AppendChar('[');
+ JoinToString(
+ builder,
+ values.Begin(),
+ values.End(),
+ [&] (TStringBuilderBase* builder, const TUnversionedValue& value) {
+ FormatValue(builder, value, format);
+ });
+ builder->AppendChar(']');
+}
+
void FormatValue(TStringBuilderBase* builder, TUnversionedRow row, TStringBuf format)
{
if (row) {
- builder->AppendChar('[');
- JoinToString(
- builder,
- row.Begin(),
- row.End(),
- [&] (TStringBuilderBase* builder, const TUnversionedValue& value) {
- FormatValue(builder, value, format);
- });
- builder->AppendChar(']');
+ FormatValue(builder, row.Elements(), format);
} else {
builder->AppendString("<null>");
}
diff --git a/yt/yt/client/table_client/unversioned_row.h b/yt/yt/client/table_client/unversioned_row.h
index 02b242ce52..3bbd4d6713 100644
--- a/yt/yt/client/table_client/unversioned_row.h
+++ b/yt/yt/client/table_client/unversioned_row.h
@@ -920,6 +920,7 @@ TKeyRef ToKeyRef(TUnversionedRow row, int prefixLength);
////////////////////////////////////////////////////////////////////////////////
+void FormatValue(TStringBuilderBase* builder, TUnversionedValueRange values, TStringBuf format);
void FormatValue(TStringBuilderBase* builder, TUnversionedRow row, TStringBuf format);
void FormatValue(TStringBuilderBase* builder, TMutableUnversionedRow row, TStringBuf format);
void FormatValue(TStringBuilderBase* builder, const TUnversionedOwningRow& row, TStringBuf format);
@@ -1000,3 +1001,12 @@ struct NYT::TFormatArg<T>
static constexpr auto FlagSpecifiers
= TFormatArgBase::ExtendFlags</*Hot*/ true, 1, std::array{'k'}>();
};
+
+template <class T>
+ requires std::derived_from<std::remove_cvref_t<T>, NYT::NTableClient::TUnversionedValueRange>
+struct NYT::TFormatArg<T>
+ : public NYT::TFormatArgBase
+{
+ static constexpr auto FlagSpecifiers
+ = TFormatArgBase::ExtendFlags</*Hot*/ true, 1, std::array{'k'}>();
+};