mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
Write empty values for Google wrappers
This commit is contained in:
parent
ff49fad1f1
commit
10425c17b2
@ -102,6 +102,29 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
bool isGoogleWrapperMessage(const MessageDescriptor & message_descriptor)
|
||||
{
|
||||
auto message_type = message_descriptor.well_known_type();
|
||||
return (message_type >= google::protobuf::Descriptor::WELLKNOWNTYPE_DOUBLEVALUE)
|
||||
&& (message_type <= google::protobuf::Descriptor::WELLKNOWNTYPE_BOOLVALUE);
|
||||
}
|
||||
|
||||
bool isGoogleWrapperField(const FieldDescriptor & field_descriptor)
|
||||
{
|
||||
|
||||
const auto * message_descriptor = field_descriptor.message_type();
|
||||
if (message_descriptor == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isGoogleWrapperMessage(*message_descriptor);
|
||||
}
|
||||
|
||||
std::string_view googleWrapperColumnName(const FieldDescriptor & field_descriptor)
|
||||
{
|
||||
assert(isGoogleWrapperField(field_descriptor));
|
||||
return field_descriptor.message_type()->field(0)->name();
|
||||
}
|
||||
|
||||
// Should we omit null values (zero for numbers / empty string for strings) while storing them.
|
||||
bool shouldSkipZeroOrEmpty(const FieldDescriptor & field_descriptor)
|
||||
@ -110,6 +133,8 @@ namespace
|
||||
return false;
|
||||
if (field_descriptor.containing_type()->options().map_entry())
|
||||
return false;
|
||||
if (isGoogleWrapperField(field_descriptor))
|
||||
return false;
|
||||
return field_descriptor.message_type() || (field_descriptor.file()->syntax() == google::protobuf::FileDescriptor::SYNTAX_PROTO3);
|
||||
}
|
||||
|
||||
@ -143,30 +168,6 @@ namespace
|
||||
return field_descriptor.file()->syntax() == google::protobuf::FileDescriptor::SYNTAX_PROTO3;
|
||||
}
|
||||
|
||||
bool isGoogleWrapperMessage(const MessageDescriptor & message_descriptor)
|
||||
{
|
||||
auto message_type = message_descriptor.well_known_type();
|
||||
return (message_type >= google::protobuf::Descriptor::WELLKNOWNTYPE_DOUBLEVALUE)
|
||||
&& (message_type <= google::protobuf::Descriptor::WELLKNOWNTYPE_BOOLVALUE);
|
||||
}
|
||||
|
||||
bool isGoogleWrapperField(const FieldDescriptor & field_descriptor)
|
||||
{
|
||||
|
||||
const auto * message_descriptor = field_descriptor.message_type();
|
||||
if (message_descriptor == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return isGoogleWrapperMessage(*message_descriptor);
|
||||
}
|
||||
|
||||
std::string_view googleWrapperColumnName(const FieldDescriptor & field_descriptor)
|
||||
{
|
||||
assert(isGoogleWrapperField(field_descriptor));
|
||||
return field_descriptor.message_type()->field(0)->name();
|
||||
}
|
||||
|
||||
WriteBuffer & writeIndent(WriteBuffer & out, size_t size) { return out << String(size * 4, ' '); }
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user