[enhancement](serialize) add dcheck to ensure pb type is set (#24645)

should check the pb's type is set, or the deserialize will core.
should not return unknown type because deserialize will core.
---------

Co-authored-by: yiguolei <yiguolei@gmail.com>
This commit is contained in:
yiguolei
2023-09-20 10:42:28 +08:00
committed by GitHub
parent 49f6eda843
commit c3b3f0f00a
2 changed files with 2 additions and 0 deletions

View File

@ -827,6 +827,7 @@ Status Block::serialize(int be_exec_version, PBlock* pblock,
for (const auto& c : *this) {
PColumnMeta* pcm = pblock->add_column_metas();
c.to_pb_column_meta(pcm);
DCHECK(pcm->type() != PGenericType::UNKNOWN) << " forget to set pb type";
// get serialized size
content_uncompressed_size +=
c.type->get_uncompressed_serialized_bytes(*(c.column), pblock->be_exec_version());

View File

@ -174,6 +174,7 @@ PGenericType_TypeId IDataType::get_pdata_type(const IDataType* data_type) {
case TypeIndex::TimeV2:
return PGenericType::TIMEV2;
default:
LOG(FATAL) << fmt::format("could not mapping type {} to pb type", data_type->get_type_id());
return PGenericType::UNKNOWN;
}
}