Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
gdliu3 committed Jul 24, 2024
1 parent e15b12e commit 5eebb81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions be/src/runtime/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ struct TypeDescriptor {
TypeDescriptor() : type(INVALID_TYPE), len(-1), precision(-1), scale(-1) {}

// explicit TypeDescriptor(PrimitiveType type) :
TypeDescriptor(PrimitiveType type) : type(type), len(-1), precision(-1), scale(-1) {
TypeDescriptor(PrimitiveType type, int64_t scale = -1)
: type(type), len(-1), precision(-1), scale(scale) {
if (type == TYPE_DECIMALV2) {
precision = 27;
scale = 9;
if (scale == -1) {
scale = 9;
}
} else if (type == TYPE_DATETIMEV2) {
precision = 18;
scale = 6;
if (scale == -1) {
scale = 6;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/data_types/data_type_time_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class DataTypeDateTimeV2 final : public DataTypeNumberBase<UInt64> {
DataTypeDateTimeV2(const DataTypeDateTimeV2& rhs) : _scale(rhs._scale) {}
TypeIndex get_type_id() const override { return TypeIndex::DateTimeV2; }
TypeDescriptor get_type_as_type_descriptor() const override {
return TypeDescriptor(TYPE_DATETIMEV2);
return TypeDescriptor(TYPE_DATETIMEV2, _scale);
}

doris::FieldType get_storage_field_type() const override {
Expand Down

0 comments on commit 5eebb81

Please sign in to comment.