diff options
author | nadya73 <nadya73@yandex-team.com> | 2025-02-07 11:04:18 +0300 |
---|---|---|
committer | nadya73 <nadya73@yandex-team.com> | 2025-02-07 11:44:51 +0300 |
commit | f5d9f371e4e2b705be312223ebd0f6dfdbebb82c (patch) | |
tree | dde7b77ee5e073fc5c71ed68a1a907ddecaec02d | |
parent | 1dbe6c9e093a4551bf0ad437c01c4c93cff14f3f (diff) | |
download | ydb-f5d9f371e4e2b705be312223ebd0f6dfdbebb82c.tar.gz |
YT-16386: Return original type of type_v1 columns in web_json
* Changelog entry
Type: feature
Component: proxy
Preserve original column types (e.g., `timestamp`) in `web_json` format of `select_rows` responses.
commit_hash:9e8bfa1fdc15eba92b2e105635446d49d57a1358
-rw-r--r-- | yt/yt/client/api/client_common.h | 3 | ||||
-rw-r--r-- | yt/yt/client/driver/table_commands.cpp | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/yt/yt/client/api/client_common.h b/yt/yt/client/api/client_common.h index 58629a3167..6c88559134 100644 --- a/yt/yt/client/api/client_common.h +++ b/yt/yt/client/api/client_common.h @@ -192,6 +192,9 @@ struct TSelectRowsOptions bool UseCanonicalNullRelations = false; //! Merge versioned rows from different stores when reading. bool MergeVersionedRows = true; + //! For internal use only. + //! Use original table schema in result rowset. + bool UseOriginalTableSchema = false; }; struct TFallbackReplicaOptions diff --git a/yt/yt/client/driver/table_commands.cpp b/yt/yt/client/driver/table_commands.cpp index 3cef7004d1..ce1155abfd 100644 --- a/yt/yt/client/driver/table_commands.cpp +++ b/yt/yt/client/driver/table_commands.cpp @@ -882,6 +882,12 @@ void TSelectRowsCommand::DoExecute(ICommandContextPtr context) Options.Timestamp); } + auto format = context->GetOutputFormat(); + // Allows to display simple types like `timestamp` correctly in UI (YT-16386). + if (format.GetType() == EFormatType::WebJson) { + Options.UseOriginalTableSchema = true; + } + auto result = WaitFor(clientBase->SelectRows(Query, Options)) .ValueOrThrow(); @@ -896,7 +902,6 @@ void TSelectRowsCommand::DoExecute(ICommandContextPtr context) }); } - auto format = context->GetOutputFormat(); auto output = context->Request().OutputStream; auto writer = CreateSchemafulWriterForFormat(format, rowset->GetSchema(), output); |