better check of version for sparse serialization

This commit is contained in:
Anton Popov 2023-08-01 23:39:52 +00:00
parent 525da38316
commit aec0667f16
3 changed files with 16 additions and 4 deletions

View File

@ -44,6 +44,8 @@
#define DBMS_MIN_PROTOCOL_VERSION_WITH_INCREMENTAL_PROFILE_EVENTS 54451 #define DBMS_MIN_PROTOCOL_VERSION_WITH_INCREMENTAL_PROFILE_EVENTS 54451
#define DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION 54454
#define DBMS_MIN_PROTOCOL_VERSION_WITH_INITIAL_QUERY_START_TIME 54449 #define DBMS_MIN_PROTOCOL_VERSION_WITH_INITIAL_QUERY_START_TIME 54449
#define DBMS_MIN_PROTOCOL_VERSION_WITH_PROFILE_EVENTS_IN_INSERT 54456 #define DBMS_MIN_PROTOCOL_VERSION_WITH_PROFILE_EVENTS_IN_INSERT 54456

View File

@ -173,7 +173,7 @@ Block NativeReader::read()
setVersionToAggregateFunctions(column.type, true, server_revision); setVersionToAggregateFunctions(column.type, true, server_revision);
SerializationPtr serialization; SerializationPtr serialization;
if (server_revision >= DBMS_MIN_REVISION_WITH_SPARSE_SERIALIZATION) if (server_revision >= DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION)
{ {
auto info = column.type->createSerializationInfo({}); auto info = column.type->createSerializationInfo({});

View File

@ -132,12 +132,22 @@ size_t NativeWriter::write(const Block & block)
/// Serialization. Dynamic, if client supports it. /// Serialization. Dynamic, if client supports it.
SerializationPtr serialization; SerializationPtr serialization;
if (client_revision >= DBMS_MIN_REVISION_WITH_SPARSE_SERIALIZATION) if (client_revision >= DBMS_MIN_REVISION_WITH_CUSTOM_SERIALIZATION)
{ {
auto info = column.type->getSerializationInfo(*column.column); auto info = column.type->getSerializationInfo(*column.column);
serialization = column.type->getSerialization(*info); bool has_custom = false;
if (client_revision >= DBMS_MIN_REVISION_WITH_SPARSE_SERIALIZATION)
{
serialization = column.type->getSerialization(*info);
has_custom = info->hasCustomSerialization();
}
else
{
serialization = column.type->getDefaultSerialization();
column.column = recursiveRemoveSparse(column.column);
}
bool has_custom = info->hasCustomSerialization();
writeBinary(static_cast<UInt8>(has_custom), ostr); writeBinary(static_cast<UInt8>(has_custom), ostr);
if (has_custom) if (has_custom)
info->serialializeKindBinary(ostr); info->serialializeKindBinary(ostr);