diff options
author | Ivan Nikolaev <ivannik@ydb.tech> | 2025-03-14 13:51:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-14 13:51:23 +0300 |
commit | f5cf28c593c84581b645fc0a778e35aa1b2e382a (patch) | |
tree | cdee41f77d91bc882ab40e9a41fde11692aa7d66 | |
parent | bba21cb0db2e074cac5ac4211b78c0852a2b67fe (diff) | |
download | ydb-f5cf28c593c84581b645fc0a778e35aa1b2e382a.tar.gz |
Datahard: fix UUID type conversion in ReadTable (#15721)
-rw-r--r-- | ydb/core/tx/datashard/datashard_ut_read_table.cpp | 36 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_ut_read_table.h | 3 | ||||
-rw-r--r-- | ydb/core/tx/datashard/read_table_scan.cpp | 1 |
3 files changed, 39 insertions, 1 deletions
diff --git a/ydb/core/tx/datashard/datashard_ut_read_table.cpp b/ydb/core/tx/datashard/datashard_ut_read_table.cpp index dfa7a5e028..22e3b3170b 100644 --- a/ydb/core/tx/datashard/datashard_ut_read_table.cpp +++ b/ydb/core/tx/datashard/datashard_ut_read_table.cpp @@ -598,7 +598,41 @@ Y_UNIT_TEST_SUITE(DataShardReadTableSnapshots) { UNIT_ASSERT(table1state.IsError); UNIT_ASSERT_VALUES_EQUAL(table1state.LastResult, "ERROR: ExecError\n"); - } + } + + Y_UNIT_TEST(ReadTableUUID) { + TPortManager pm; + TServerSettings serverSettings(pm.GetPort(2134)); + serverSettings.SetDomainName("Root") + .SetUseRealThreads(false); + + Tests::TServer::TPtr server = new TServer(serverSettings); + auto &runtime = *server->GetRuntime(); + auto sender = runtime.AllocateEdgeActor(); + + runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE); + runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG); + + InitRoot(server, sender); + + CreateShardedTable(server, sender, "/Root", "table-1", + TShardedTableOptions().Columns({ + {"key", "Uuid", true, false}, + {"value", "Uuid", false, false} + })); + auto shards = GetTableShards(server, sender, "/Root/table-1"); + + ExecSQL(server, sender, "UPSERT INTO `/Root/table-1` (key, value) VALUES " + "(Uuid('5e32442b-4613-40b7-8506-b14d86b74ef1'), Uuid('65d4d0aa-1612-4887-86dd-834e4cfc3df5')), " + "(Uuid('bbf1d45a-af5f-4939-b58a-2be39fd2f06e'), Uuid('710c9ea5-9fa2-4606-a35f-608d0556eb6f')), " + "(Uuid('303f21b5-3805-4133-b706-bfc0e071c528'), Uuid('522e048c-9b4b-4d38-8c89-3996cdaa1c8d'));"); + + auto table1 = TReadTableState(server, MakeReadTableSettings("/Root/table-1")).All(); + UNIT_ASSERT_VALUES_EQUAL(table1, + "key = 5e32442b-4613-40b7-8506-b14d86b74ef1, value = 65d4d0aa-1612-4887-86dd-834e4cfc3df5\n" + "key = bbf1d45a-af5f-4939-b58a-2be39fd2f06e, value = 710c9ea5-9fa2-4606-a35f-608d0556eb6f\n" + "key = 303f21b5-3805-4133-b706-bfc0e071c528, value = 522e048c-9b4b-4d38-8c89-3996cdaa1c8d\n"); + } } // Y_UNIT_TEST_SUITE(DataShardReadTableSnapshots) diff --git a/ydb/core/tx/datashard/datashard_ut_read_table.h b/ydb/core/tx/datashard/datashard_ut_read_table.h index 485a1d2d14..1733b5bb60 100644 --- a/ydb/core/tx/datashard/datashard_ut_read_table.h +++ b/ydb/core/tx/datashard/datashard_ut_read_table.h @@ -178,6 +178,9 @@ namespace NDataShardReadTableTest { case NYdb::EPrimitiveType::Timestamp: out << parser.GetTimestamp(); break; + case NYdb::EPrimitiveType::Uuid: + out << parser.GetUuid().ToString(); + break; default: Y_ABORT("Unhandled"); diff --git a/ydb/core/tx/datashard/read_table_scan.cpp b/ydb/core/tx/datashard/read_table_scan.cpp index 772cffdc65..141a1b3eee 100644 --- a/ydb/core/tx/datashard/read_table_scan.cpp +++ b/ydb/core/tx/datashard/read_table_scan.cpp @@ -117,6 +117,7 @@ Y_FORCE_INLINE bool AddCell(TOutValue& row, NScheme::TTypeInfo type, const TCell val.set_bytes_value(cell.Data(), cell.Size()); break; } + case NUdf::TDataType<NUdf::TUuid>::Id: case NUdf::TDataType<NUdf::TDecimal>::Id: { struct TCellData { ui64 Low; |