[Fix](multi-catalog) Fix switch-case fall-through issue in multi-catalog module. (#16931)

Fix switch-case fall-through issue in multi-catalog module.
This commit is contained in:
Qi Chen
2023-02-20 21:35:41 +08:00
committed by GitHub
parent a1799e5506
commit a46941c684
12 changed files with 39 additions and 3 deletions

View File

@ -155,10 +155,15 @@ Status CsvReader::init_reader(bool is_load) {
switch (_file_format_type) {
case TFileFormatType::FORMAT_CSV_PLAIN:
[[fallthrough]];
case TFileFormatType::FORMAT_CSV_GZ:
[[fallthrough]];
case TFileFormatType::FORMAT_CSV_BZ2:
[[fallthrough]];
case TFileFormatType::FORMAT_CSV_LZ4FRAME:
[[fallthrough]];
case TFileFormatType::FORMAT_CSV_LZOP:
[[fallthrough]];
case TFileFormatType::FORMAT_CSV_DEFLATE:
_line_reader.reset(new NewPlainTextLineReader(_profile, _file_reader, _decompressor.get(),
_size, _line_delimiter,
@ -298,6 +303,7 @@ Status CsvReader::_create_decompressor() {
} else {
switch (_file_format_type) {
case TFileFormatType::FORMAT_PROTO:
[[fallthrough]];
case TFileFormatType::FORMAT_CSV_PLAIN:
compress_type = CompressType::UNCOMPRESSED;
break;

View File

@ -40,7 +40,9 @@ Status NewPlainBinaryLineReader::read_line(const uint8_t** ptr, size_t* size, bo
size_t read_size = 0;
switch (_file_type) {
case TFileType::FILE_LOCAL:
[[fallthrough]];
case TFileType::FILE_HDFS:
[[fallthrough]];
case TFileType::FILE_S3: {
size_t file_size = _file_reader->size();
file_buf.reset(new uint8_t[file_size]);

View File

@ -988,7 +988,9 @@ std::string NewJsonReader::_print_json_value(const rapidjson::Value& value) {
Status NewJsonReader::_read_one_message(std::unique_ptr<uint8_t[]>* file_buf, size_t* read_size) {
switch (_params.file_type) {
case TFileType::FILE_LOCAL:
[[fallthrough]];
case TFileType::FILE_HDFS:
[[fallthrough]];
case TFileType::FILE_S3: {
size_t file_size = _file_reader->size();
file_buf->reset(new uint8_t[file_size]);

View File

@ -331,8 +331,11 @@ static std::tuple<bool, orc::Literal> convert_to_orc_literal(const orc::Type* ty
case orc::TypeKind::DOUBLE:
return std::make_tuple(true, orc::Literal(*((double*)value)));
case orc::TypeKind::STRING:
[[fallthrough]];
case orc::TypeKind::BINARY:
[[fallthrough]];
case orc::TypeKind::CHAR:
[[fallthrough]];
case orc::TypeKind::VARCHAR: {
StringRef* string_value = (StringRef*)value;
return std::make_tuple(true, orc::Literal(string_value->data, string_value->size));

View File

@ -81,6 +81,7 @@ Status ByteArrayDictDecoder::decode_values(MutableColumnPtr& doris_column, DataT
TypeIndex logical_type = remove_nullable(data_type)->get_type_id();
switch (logical_type) {
case TypeIndex::String:
[[fallthrough]];
case TypeIndex::FixedString: {
size_t dict_index = 0;

View File

@ -42,6 +42,7 @@ Status ByteArrayPlainDecoder::decode_values(MutableColumnPtr& doris_column, Data
TypeIndex logical_type = remove_nullable(data_type)->get_type_id();
switch (logical_type) {
case TypeIndex::String:
[[fallthrough]];
case TypeIndex::FixedString: {
ColumnSelectVector::DataReadType read_type;
while (size_t run_length = select_vector.get_next_run(&read_type)) {

View File

@ -41,10 +41,15 @@ Status Decoder::get_decoder(tparquet::Type::type type, tparquet::Encoding::type
decoder.reset(new ByteArrayPlainDecoder());
break;
case tparquet::Type::INT32:
[[fallthrough]];
case tparquet::Type::INT64:
[[fallthrough]];
case tparquet::Type::INT96:
[[fallthrough]];
case tparquet::Type::FLOAT:
[[fallthrough]];
case tparquet::Type::DOUBLE:
[[fallthrough]];
case tparquet::Type::FIXED_LEN_BYTE_ARRAY:
decoder.reset(new FixLengthPlainDecoder(type));
break;
@ -56,9 +61,7 @@ Status Decoder::get_decoder(tparquet::Type::type type, tparquet::Encoding::type
case tparquet::Encoding::RLE_DICTIONARY:
switch (type) {
case tparquet::Type::BOOLEAN:
if (encoding != tparquet::Encoding::PLAIN) {
return Status::InternalError("Bool type can't has dictionary page");
}
return Status::InternalError("Bool type can't has dictionary page");
case tparquet::Type::BYTE_ARRAY:
decoder.reset(new ByteArrayDictDecoder());
break;

View File

@ -125,6 +125,7 @@ public:
}
break;
case TypeIndex::String:
[[fallthrough]];
case TypeIndex::FixedString:
break;
default:
@ -405,6 +406,7 @@ public:
}
break;
case TypeIndex::String:
[[fallthrough]];
case TypeIndex::FixedString:
if (_physical_type == tparquet::Type::FIXED_LEN_BYTE_ARRAY) {
return _decode_string(doris_column, select_vector);

View File

@ -109,6 +109,7 @@ Status FixLengthPlainDecoder::decode_values(MutableColumnPtr& doris_column, Data
}
break;
case TypeIndex::String:
[[fallthrough]];
case TypeIndex::FixedString:
if (_physical_type == tparquet::Type::FIXED_LEN_BYTE_ARRAY) {
return _decode_string(doris_column, select_vector);

View File

@ -139,7 +139,9 @@ private:
FOR_REINTERPRET_TYPES(DISPATCH)
#undef DISPATCH
case TYPE_VARCHAR:
[[fallthrough]];
case TYPE_CHAR:
[[fallthrough]];
case TYPE_STRING:
if constexpr (std::is_same_v<CppType, StringRef>) {
min_value = StringRef(encoded_min);
@ -180,7 +182,9 @@ private:
}
break;
case TYPE_DECIMAL32:
[[fallthrough]];
case TYPE_DECIMAL64:
[[fallthrough]];
case TYPE_DECIMAL128I:
if constexpr (std::is_same_v<CppType, int32_t> || std::is_same_v<CppType, int64_t> ||
std::is_same_v<CppType, __int128_t>) {
@ -213,6 +217,7 @@ private:
}
break;
case TYPE_DATE:
[[fallthrough]];
case TYPE_DATEV2:
if (physical_type == tparquet::Type::INT32) {
int64_t min_date_value =
@ -231,6 +236,7 @@ private:
}
break;
case TYPE_DATETIME:
[[fallthrough]];
case TYPE_DATETIMEV2:
if (physical_type == tparquet::Type::INT96) {
ParquetInt96 datetime96_min =

View File

@ -190,6 +190,7 @@ TypeDescriptor FieldDescriptor::get_doris_type(const tparquet::SchemaElement& ph
type = TypeDescriptor(TYPE_DOUBLE);
break;
case tparquet::Type::BYTE_ARRAY:
[[fallthrough]];
case tparquet::Type::FIXED_LEN_BYTE_ARRAY:
type = TypeDescriptor(TYPE_STRING);
break;
@ -245,10 +246,12 @@ TypeDescriptor FieldDescriptor::convert_to_doris_type(tparquet::ConvertedType::t
type = TypeDescriptor(TYPE_DATEV2);
break;
case tparquet::ConvertedType::type::TIME_MILLIS:
[[fallthrough]];
case tparquet::ConvertedType::type::TIME_MICROS:
type = TypeDescriptor(TYPE_TIMEV2);
break;
case tparquet::ConvertedType::type::TIMESTAMP_MILLIS:
[[fallthrough]];
case tparquet::ConvertedType::type::TIMESTAMP_MICROS:
type = TypeDescriptor(TYPE_DATETIMEV2);
break;
@ -256,15 +259,19 @@ TypeDescriptor FieldDescriptor::convert_to_doris_type(tparquet::ConvertedType::t
type = TypeDescriptor(TYPE_TINYINT);
break;
case tparquet::ConvertedType::type::UINT_8:
[[fallthrough]];
case tparquet::ConvertedType::type::INT_16:
type = TypeDescriptor(TYPE_SMALLINT);
break;
case tparquet::ConvertedType::type::UINT_16:
[[fallthrough]];
case tparquet::ConvertedType::type::INT_32:
type = TypeDescriptor(TYPE_INT);
break;
case tparquet::ConvertedType::type::UINT_32:
[[fallthrough]];
case tparquet::ConvertedType::type::UINT_64:
[[fallthrough]];
case tparquet::ConvertedType::type::INT_64:
type = TypeDescriptor(TYPE_BIGINT);
break;

View File

@ -232,9 +232,11 @@ Status ColumnChunkReader::decode_values(MutableColumnPtr& doris_column, DataType
int32_t ColumnChunkReader::_get_type_length() {
switch (_field_schema->physical_type) {
case tparquet::Type::INT32:
[[fallthrough]];
case tparquet::Type::FLOAT:
return 4;
case tparquet::Type::INT64:
[[fallthrough]];
case tparquet::Type::DOUBLE:
return 8;
case tparquet::Type::INT96: