summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ydb/core/scheme/scheme_tablecell.cpp11
-rw-r--r--ydb/core/scheme/scheme_tablecell.h4
-rw-r--r--ydb/core/scheme/scheme_tablecell_ut.cpp2
3 files changed, 11 insertions, 6 deletions
diff --git a/ydb/core/scheme/scheme_tablecell.cpp b/ydb/core/scheme/scheme_tablecell.cpp
index 521a8d805f6..854fea5cf5d 100644
--- a/ydb/core/scheme/scheme_tablecell.cpp
+++ b/ydb/core/scheme/scheme_tablecell.cpp
@@ -209,7 +209,7 @@ namespace {
return false;
}
- Y_FORCE_INLINE bool TryDeserializeCellMatrix(const TString& data, TString& resultBuffer, TVector<TCell>& resultCells) {
+ Y_FORCE_INLINE bool TryDeserializeCellMatrix(const TString& data, TString& resultBuffer, TVector<TCell>& resultCells, ui32& rowCount, ui16& colCount) {
resultBuffer.clear();
resultCells.clear();
@@ -221,13 +221,12 @@ namespace {
if (Y_UNLIKELY(bufEnd - buf < static_cast<ptrdiff_t>(sizeof(ui16))))
return false;
- ui64 cellCount;
- ui32 rowCount = ReadUnaligned<ui32>(buf);
+ rowCount = ReadUnaligned<ui32>(buf);
buf += sizeof(rowCount);
- ui16 colCount = ReadUnaligned<ui16>(buf);
+ colCount = ReadUnaligned<ui16>(buf);
buf += sizeof(colCount);
- cellCount = (ui64)rowCount * (ui64)colCount;
+ ui64 cellCount = (ui64)rowCount * (ui64)colCount;
if (TryDeserializeCellVecBody(buf, bufEnd, cellCount, resultCells)) {
resultBuffer = data;
return true;
@@ -275,7 +274,7 @@ TString TSerializedCellMatrix::Serialize(TConstArrayRef<TCell> cells, ui32 rowCo
}
bool TSerializedCellMatrix::DoTryParse(const TString& data) {
- return TryDeserializeCellMatrix(data, Buf, Cells);
+ return TryDeserializeCellMatrix(data, Buf, Cells, RowCount, ColCount);
}
void TCellsStorage::Reset(TArrayRef<const TCell> cells)
diff --git a/ydb/core/scheme/scheme_tablecell.h b/ydb/core/scheme/scheme_tablecell.h
index d9529eaf1b4..7bea34cbdaf 100644
--- a/ydb/core/scheme/scheme_tablecell.h
+++ b/ydb/core/scheme/scheme_tablecell.h
@@ -567,6 +567,8 @@ public:
TSerializedCellMatrix(const TSerializedCellMatrix& other)
: Buf(other.Buf)
, Cells(other.Cells)
+ , RowCount(other.RowCount)
+ , ColCount(other.ColCount)
{
Y_ABORT_UNLESS(Buf.data() == other.Buf.data(), "Buffer must be shared");
}
@@ -595,6 +597,8 @@ public:
Buf = std::move(other.Buf);
Y_ABORT_UNLESS(Buf.data() == otherPtr, "Buffer address must not change");
Cells = std::move(other.Cells);
+ RowCount = std::move(other.RowCount);
+ ColCount = std::move(other.ColCount);
return *this;
}
diff --git a/ydb/core/scheme/scheme_tablecell_ut.cpp b/ydb/core/scheme/scheme_tablecell_ut.cpp
index 47355d229a2..4a9effa942c 100644
--- a/ydb/core/scheme/scheme_tablecell_ut.cpp
+++ b/ydb/core/scheme/scheme_tablecell_ut.cpp
@@ -232,6 +232,8 @@ Y_UNIT_TEST_SUITE(Scheme) {
}
void CompareTypedCellMatrix(const TSerializedCellMatrix& matrix, const TVector<TCell>& cells, const TVector<TTypeInfo>& types, ui64 hash) {
+ UNIT_ASSERT_VALUES_EQUAL(matrix.GetCells().size(), matrix.GetRowCount() * matrix.GetColCount());
+
UNIT_ASSERT_VALUES_EQUAL(matrix.GetCells().size(), cells.size());
UNIT_ASSERT_VALUES_EQUAL(matrix.GetCells().size(), types.size());