rm unused (read|write)Text methods

This commit is contained in:
Nikita Taranov 2022-11-10 21:00:24 +01:00
parent adafbcf214
commit a7e7480584
10 changed files with 0 additions and 272 deletions

View File

@ -19,11 +19,9 @@ struct ClearableHashSetState
/// Serialization, in binary and text form.
void write(DB::WriteBuffer & wb) const { DB::writeBinary(version, wb); }
void writeText(DB::WriteBuffer & wb) const { DB::writeText(version, wb); }
/// Deserialization, in binary and text form.
void read(DB::ReadBuffer & rb) { DB::readBinary(version, rb); }
void readText(DB::ReadBuffer & rb) { DB::readText(version, rb); }
};

View File

@ -395,26 +395,6 @@ public:
}
}
void writeText(DB::WriteBuffer & wb) const
{
Cell::State::writeText(wb);
DB::writeText(size(), wb);
if (!buf)
return;
for (auto ptr = buf, buf_end = buf + NUM_CELLS; ptr < buf_end; ++ptr)
{
if (!ptr->isZero(*this))
{
DB::writeChar(',', wb);
DB::writeText(ptr - buf, wb);
DB::writeChar(',', wb);
ptr->writeText(wb);
}
}
}
void read(DB::ReadBuffer & rb)
{
Cell::State::read(rb);
@ -435,28 +415,6 @@ public:
}
}
void readText(DB::ReadBuffer & rb)
{
Cell::State::readText(rb);
destroyElements();
size_t m_size;
DB::readText(m_size, rb);
this->setSize(m_size);
free();
alloc();
for (size_t i = 0; i < m_size; ++i)
{
size_t place_value = 0;
DB::assertChar(',', rb);
DB::readText(place_value, rb);
Cell x;
DB::assertChar(',', rb);
x.readText(rb);
new (&buf[place_value]) Cell(x, *this);
}
}
size_t size() const { return this->getSize(buf, *this, NUM_CELLS); }
bool empty() const { return this->isEmpty(buf, *this, NUM_CELLS); }

View File

@ -103,13 +103,6 @@ struct HashMapCell
DB::writeBinary(value.second, wb);
}
void writeText(DB::WriteBuffer & wb) const
{
DB::writeDoubleQuoted(value.first, wb);
DB::writeChar(',', wb);
DB::writeDoubleQuoted(value.second, wb);
}
/// Deserialization, in binary and text form.
void read(DB::ReadBuffer & rb)
{
@ -117,13 +110,6 @@ struct HashMapCell
DB::readBinary(value.second, rb);
}
void readText(DB::ReadBuffer & rb)
{
DB::readDoubleQuoted(value.first, rb);
DB::assertChar(',', rb);
DB::readDoubleQuoted(value.second, rb);
}
static bool constexpr need_to_notify_cell_during_move = false;
static void move(HashMapCell * /* old_location */, HashMapCell * /* new_location */) {}

View File

@ -44,24 +44,6 @@ public:
if (!rhs.buf[i].isZero(*this))
this->insert(rhs.buf[i].getValue());
}
void readAndMerge(DB::ReadBuffer & rb)
{
Cell::State::read(rb);
size_t new_size = 0;
DB::readVarUInt(new_size, rb);
this->resize(new_size);
for (size_t i = 0; i < new_size; ++i)
{
Cell x;
x.read(rb);
this->insert(x.getValue());
}
}
};

View File

@ -57,11 +57,9 @@ struct HashTableNoState
{
/// Serialization, in binary and text form.
void write(DB::WriteBuffer &) const {}
void writeText(DB::WriteBuffer &) const {}
/// Deserialization, in binary and text form.
void read(DB::ReadBuffer &) {}
void readText(DB::ReadBuffer &) {}
};
@ -200,11 +198,9 @@ struct HashTableCell
/// Serialization, in binary and text form.
void write(DB::WriteBuffer & wb) const { DB::writeBinary(key, wb); }
void writeText(DB::WriteBuffer & wb) const { DB::writeDoubleQuoted(key, wb); }
/// Deserialization, in binary and text form.
void read(DB::ReadBuffer & rb) { DB::readBinary(key, rb); }
void readText(DB::ReadBuffer & rb) { DB::readDoubleQuoted(key, rb); }
/// When cell pointer is moved during erase, reinsert or resize operations
@ -1255,30 +1251,6 @@ public:
ptr->write(wb);
}
void writeText(DB::WriteBuffer & wb) const
{
Cell::State::writeText(wb);
DB::writeText(m_size, wb);
if (this->hasZero())
{
DB::writeChar(',', wb);
this->zeroValue()->writeText(wb);
}
if (!buf)
return;
for (auto ptr = buf, buf_end = buf + grower.bufSize(); ptr < buf_end; ++ptr)
{
if (!ptr->isZero(*this))
{
DB::writeChar(',', wb);
ptr->writeText(wb);
}
}
}
void read(DB::ReadBuffer & rb)
{
Cell::State::read(rb);
@ -1303,32 +1275,6 @@ public:
}
}
void readText(DB::ReadBuffer & rb)
{
Cell::State::readText(rb);
destroyElements();
this->clearHasZero();
m_size = 0;
size_t new_size = 0;
DB::readText(new_size, rb);
free();
Grower new_grower = grower;
new_grower.set(new_size);
alloc(new_grower);
for (size_t i = 0; i < new_size; ++i)
{
Cell x;
DB::assertChar(',', rb);
x.readText(rb);
insert(x.getValue());
}
}
size_t size() const
{
return m_size;

View File

@ -259,18 +259,6 @@ public:
buf[i].write(wb);
}
void writeText(DB::WriteBuffer & wb) const
{
Cell::State::writeText(wb);
DB::writeText(m_size, wb);
for (size_t i = 0; i < m_size; ++i)
{
DB::writeChar(',', wb);
buf[i].writeText(wb);
}
}
void read(DB::ReadBuffer & rb)
{
Cell::State::read(rb);
@ -289,28 +277,6 @@ public:
m_size = new_size;
}
void readText(DB::ReadBuffer & rb)
{
Cell::State::readText(rb);
m_size = 0;
size_t new_size = 0;
DB::readText(new_size, rb);
if (new_size > capacity)
throw DB::Exception("Illegal size", DB::ErrorCodes::INCORRECT_DATA);
for (size_t i = 0; i < new_size; ++i)
{
DB::assertChar(',', rb);
buf[i].readText(rb);
}
m_size = new_size;
}
size_t size() const
{
return m_size;

View File

@ -141,9 +141,7 @@ public:
}
void write(DB::WriteBuffer & wb) const { zeroValue()->write(wb); }
void writeText(DB::WriteBuffer & wb) const { zeroValue()->writeText(wb); }
void read(DB::ReadBuffer & rb) { zeroValue()->read(rb); }
void readText(DB::ReadBuffer & rb) { zeroValue()->readText(rb); }
size_t size() const { return hasZero() ? 1 : 0; }
bool empty() const { return !hasZero(); }
size_t getBufferSizeInBytes() const { return sizeof(Cell); }
@ -379,19 +377,6 @@ public:
ms.write(wb);
}
void writeText(DB::WriteBuffer & wb) const
{
m0.writeText(wb);
DB::writeChar(',', wb);
m1.writeText(wb);
DB::writeChar(',', wb);
m2.writeText(wb);
DB::writeChar(',', wb);
m3.writeText(wb);
DB::writeChar(',', wb);
ms.writeText(wb);
}
void read(DB::ReadBuffer & rb)
{
m0.read(rb);
@ -401,19 +386,6 @@ public:
ms.read(rb);
}
void readText(DB::ReadBuffer & rb)
{
m0.readText(rb);
DB::assertChar(',', rb);
m1.readText(rb);
DB::assertChar(',', rb);
m2.readText(rb);
DB::assertChar(',', rb);
m3.readText(rb);
DB::assertChar(',', rb);
ms.readText(rb);
}
size_t size() const { return m0.size() + m1.size() + m2.size() + m3.size() + ms.size(); }
bool empty() const { return m0.empty() && m1.empty() && m2.empty() && m3.empty() && ms.empty(); }

View File

@ -290,33 +290,12 @@ public:
impls[i].write(wb);
}
void writeText(DB::WriteBuffer & wb) const
{
for (UInt32 i = 0; i < NUM_BUCKETS; ++i)
{
if (i != 0)
DB::writeChar(',', wb);
impls[i].writeText(wb);
}
}
void read(DB::ReadBuffer & rb)
{
for (UInt32 i = 0; i < NUM_BUCKETS; ++i)
impls[i].read(rb);
}
void readText(DB::ReadBuffer & rb)
{
for (UInt32 i = 0; i < NUM_BUCKETS; ++i)
{
if (i != 0)
DB::assertChar(',', rb);
impls[i].readText(rb);
}
}
size_t size() const
{
size_t res = 0;

View File

@ -179,32 +179,12 @@ public:
impls[i].write(wb);
}
void writeText(DB::WriteBuffer & wb) const
{
for (UInt32 i = 0; i < NUM_BUCKETS; ++i)
{
if (i != 0)
DB::writeChar(',', wb);
impls[i].writeText(wb);
}
}
void read(DB::ReadBuffer & rb)
{
for (UInt32 i = 0; i < NUM_BUCKETS; ++i)
impls[i].read(rb);
}
void readText(DB::ReadBuffer & rb)
{
for (UInt32 i = 0; i < NUM_BUCKETS; ++i)
{
if (i != 0)
DB::assertChar(',', rb);
impls[i].readText(rb);
}
}
size_t size() const
{
size_t res = 0;

View File

@ -258,29 +258,6 @@ TEST(HashTable, Erase)
TEST(HashTable, SerializationDeserialization)
{
{
/// Use dummy hash to make it reproducible if default hash implementation will be changed
using Cont = HashSet<int, DummyHash<int>, HashTableGrowerWithPrecalculation<1>>;
Cont cont;
cont.insert(1);
cont.insert(2);
cont.insert(3);
WriteBufferFromOwnString wb;
cont.writeText(wb);
std::string expected = "3,1,2,3";
ASSERT_EQ(wb.str(), expected);
ReadBufferFromString rb(expected);
Cont deserialized;
deserialized.readText(rb);
ASSERT_EQ(convertToSet(cont), convertToSet(deserialized));
}
{
using Cont = HashSet<int, DefaultHash<int>, HashTableGrowerWithPrecalculation<1>>;
@ -299,22 +276,6 @@ TEST(HashTable, SerializationDeserialization)
deserialized.read(rb);
ASSERT_EQ(convertToSet(cont), convertToSet(deserialized));
}
{
using Cont = HashSet<int, DummyHash<int>, HashTableGrowerWithPrecalculation<1>>;
Cont cont;
WriteBufferFromOwnString wb;
cont.writeText(wb);
std::string expected = "0";
ASSERT_EQ(wb.str(), expected);
ReadBufferFromString rb(expected);
Cont deserialized;
deserialized.readText(rb);
ASSERT_EQ(convertToSet(cont), convertToSet(deserialized));
}
{
using Cont = HashSet<UInt128, UInt128TrivialHash>;
Cont cont;