diff --git a/be/src/olap/tablet_reader.cpp b/be/src/olap/tablet_reader.cpp index 61a18d04ff52d8..82db776fc54228 100644 --- a/be/src/olap/tablet_reader.cpp +++ b/be/src/olap/tablet_reader.cpp @@ -277,6 +277,7 @@ TabletColumn TabletReader::materialize_column(const TabletColumn& orig) { } column_with_cast_type.set_type(filed_type); column_with_cast_type.set_precision_frac(cast_type.precision, cast_type.scale); + column_with_cast_type.set_is_decimal(cast_type.precision > 0); return column_with_cast_type; } diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h index c066ab6468478c..4fe2efc1917bee 100644 --- a/be/src/olap/tablet_schema.h +++ b/be/src/olap/tablet_schema.h @@ -178,12 +178,13 @@ class TabletColumn { const std::vector& sparse_columns() const; size_t num_sparse_columns() const { return _num_sparse_columns; } - void set_precision_frac(int32_t precision, int32_t frac, bool is_decimal = true) { + void set_precision_frac(int32_t precision, int32_t frac) { _precision = precision; _frac = frac; - _is_decimal = is_decimal; } + void set_is_decimal(bool is_decimal) { _is_decimal = is_decimal; } + Status check_valid() const { if (type() != FieldType::OLAP_FIELD_TYPE_ARRAY && type() != FieldType::OLAP_FIELD_TYPE_STRUCT && diff --git a/be/src/vec/common/schema_util.cpp b/be/src/vec/common/schema_util.cpp index 69dcce366a9015..7f5227af7ef90f 100644 --- a/be/src/vec/common/schema_util.cpp +++ b/be/src/vec/common/schema_util.cpp @@ -237,10 +237,11 @@ void get_column_by_type(const vectorized::DataTypePtr& data_type, const std::str } if (WhichDataType(*data_type).is_decimal()) { column.set_precision_frac(data_type->get_precision(), data_type->get_scale()); + column.set_is_decimal(true); return; } if (WhichDataType(*data_type).is_date_time_v2()) { - column.set_precision_frac(-1, data_type->get_scale(), false); + column.set_precision_frac(-1, data_type->get_scale()); return; } }