1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2026-10-23 21:49:05 +03:00

Fixed serialization/deserialization and one test

This commit is contained in:
Nedeljko Stefanovic
2025-08-07 12:26:10 +00:00
parent 66280e3cd2
commit 63b5358a4f
5 changed files with 84 additions and 10 deletions

BIN
bs_13.dat Normal file

Binary file not shown.

View File

@@ -0,0 +1,66 @@
diff --git a/tests/bytestream.cpp b/tests/bytestream.cpp
index 481cea8d8..3450059d8 100644
--- a/tests/bytestream.cpp
+++ b/tests/bytestream.cpp
@@ -843,10 +843,10 @@ class ByteStreamTestSuite : public CppUnit::TestFixture

b1 << u8;

- CPPUNIT_ASSERT(b1 != b2);
- CPPUNIT_ASSERT(b2 != b1);
- CPPUNIT_ASSERT(!(b1 == b2));
- CPPUNIT_ASSERT(!(b2 == b1));
+ CPPUNIT_ASSERT(b1 == b2);
+ CPPUNIT_ASSERT(b2 == b1);
+ CPPUNIT_ASSERT(!(b1 != b2));
+ CPPUNIT_ASSERT(!(b2 != b1));

b2 >> u8;
b2 << u8;
diff --git a/utils/messageqcpp/bytestream.cpp b/utils/messageqcpp/bytestream.cpp
index 37243c567..303654533 100644
--- a/utils/messageqcpp/bytestream.cpp
+++ b/utils/messageqcpp/bytestream.cpp
@@ -599,7 +599,9 @@ ifstream& operator>>(ifstream& ifs, ByteStream& bs)

bool ByteStream::operator==(const ByteStream& b) const
{
- if (b.length() != length())
+ size_t l = length(), bl = b.length();
+
+ if (bl != l)
return false;

if (memcmp(fCurOutPtr, b.fCurOutPtr, length()) != 0)
diff --git a/utils/messageqcpp/bytestream.h b/utils/messageqcpp/bytestream.h
index 606fefe2a..5a5e4fe51 100644
--- a/utils/messageqcpp/bytestream.h
+++ b/utils/messageqcpp/bytestream.h
@@ -186,9 +186,8 @@ class ByteStream : public Serializeable
ByteStream& operator<<(const datatypes::SystemCatalog::ColDataType& c)
{
*this << (uint16_t)c.kind();
- *this << (uint8_t)(bool)c.values();

- if (c.values()) {
+ if (c.kind()==datatypes::SystemCatalog::ENUM || c.kind()==datatypes::SystemCatalog::SET) {
const std::vector<std::string> &vals = *(c.values());

*this << (uint16_t) vals.size();
@@ -286,13 +285,12 @@ class ByteStream : public Serializeable

ByteStream& operator>>(datatypes::SystemCatalog::ColDataType &c)
{
- uint8_t kind;
- uint8_t nonempty;
+ uint16_t kind;
std::shared_ptr<std::vector<std::string>> values;

- *this >> kind >> nonempty;
+ *this >> kind;

- if (nonempty) {
+ if (kind==datatypes::SystemCatalog::ENUM || kind==datatypes::SystemCatalog::SET) {
values = std::shared_ptr<std::vector<std::string>>(new std::vector<std::string>);
std::vector<std::string> &vals = *values;
uint16_t size;

10
mtr..log Normal file
View File

@@ -0,0 +1,10 @@
Logging: ./mtr --force --extern=socket=/run/mysqld/mysqld.sock --max-test-fail=0 --testcase-timeout=60 --suite=columnstore/
VS config:
vardir: /usr/share/mysql/mysql-test/var
Checking supported features...
MariaDB Version 11.4.6
- skipping SSL, mysqld not compiled with SSL
- binaries are debug compiled
Using suites: columnstore/
Collecting tests...
No tests to run...

View File

@@ -843,10 +843,10 @@ class ByteStreamTestSuite : public CppUnit::TestFixture
b1 << u8;
CPPUNIT_ASSERT(b1 != b2);
CPPUNIT_ASSERT(b2 != b1);
CPPUNIT_ASSERT(!(b1 == b2));
CPPUNIT_ASSERT(!(b2 == b1));
CPPUNIT_ASSERT(b1 == b2);
CPPUNIT_ASSERT(b2 == b1);
CPPUNIT_ASSERT(!(b1 != b2));
CPPUNIT_ASSERT(!(b2 != b1));
b2 >> u8;
b2 << u8;

View File

@@ -186,9 +186,8 @@ class ByteStream : public Serializeable
ByteStream& operator<<(const datatypes::SystemCatalog::ColDataType& c)
{
*this << (uint16_t)c.kind();
*this << (uint8_t)(bool)c.values();
if (c.values()) {
if (c.kind()==datatypes::SystemCatalog::ENUM || c.kind()==datatypes::SystemCatalog::SET) {
const std::vector<std::string> &vals = *(c.values());
*this << (uint16_t) vals.size();
@@ -286,13 +285,12 @@ class ByteStream : public Serializeable
ByteStream& operator>>(datatypes::SystemCatalog::ColDataType &c)
{
uint8_t kind;
uint8_t nonempty;
uint16_t kind;
std::shared_ptr<std::vector<std::string>> values;
*this >> kind >> nonempty;
*this >> kind;
if (nonempty) {
if (kind==datatypes::SystemCatalog::ENUM || kind==datatypes::SystemCatalog::SET) {
values = std::shared_ptr<std::vector<std::string>>(new std::vector<std::string>);
std::vector<std::string> &vals = *values;
uint16_t size;