Skip to content

Commit

Permalink
compile ok
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktengg committed Sep 28, 2023
1 parent b90f63a commit d0b6295
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
2 changes: 2 additions & 0 deletions be/src/exec/olap_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ std::string cast_to_string(T value, int scale) {
return ((vectorized::Decimal<int64_t>)value).to_string(scale);
} else if constexpr (primitive_type == TYPE_DECIMAL128I) {
return ((vectorized::Decimal<int128_t>)value).to_string(scale);
} else if constexpr (primitive_type == TYPE_DECIMAL256) {
return ((vectorized::Decimal<Int256>)value).to_string(scale);
} else if constexpr (primitive_type == TYPE_TINYINT) {
return std::to_string(static_cast<int>(value));
} else if constexpr (primitive_type == TYPE_LARGEINT) {
Expand Down
8 changes: 4 additions & 4 deletions be/src/runtime/runtime_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ Status RuntimePredicate::init(const PrimitiveType type, const bool nulls_first)
_get_value_fn = get_decimal128_value;
break;
}
// case PrimitiveType::TYPE_DECIMAL256: {
// _get_value_fn = get_decimal256_value;
// break;
// }
case PrimitiveType::TYPE_DECIMAL256: {
_get_value_fn = get_decimal256_value;
break;
}
default:
return Status::InvalidArgument("unsupported runtime predicate type {}", type);
}
Expand Down
10 changes: 5 additions & 5 deletions be/src/runtime/runtime_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ class RuntimePredicate {
return cast_to_string<TYPE_DECIMAL128I, ValueType>(v.get_value(), v.get_scale());
}

// static std::string get_decimal256_value(const Field& field) {
// using ValueType = typename PrimitiveTypeTraits<TYPE_DECIMAL256>::CppType;
// auto v = field.get<DecimalField<Decimal256>>();
// return cast_to_string<TYPE_DECIMAL256, ValueType>(v.get_value(), v.get_scale());
// }
static std::string get_decimal256_value(const Field& field) {
using ValueType = typename PrimitiveTypeTraits<TYPE_DECIMAL256>::CppType;
auto v = field.get<DecimalField<Decimal256>>();
return cast_to_string<TYPE_DECIMAL256, ValueType>(v.get_value(), v.get_scale());
}
};

} // namespace vectorized
Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/common/field_visitors.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ typename std::decay_t<Visitor>::ResultType apply_visitor(Visitor&& visitor, F&&
return visitor(field.template get<DecimalField<Decimal128>>());
case Field::Types::Decimal128I:
return visitor(field.template get<DecimalField<Decimal128I>>());
// case Field::Types::Decimal256:
// return visitor(field.template get<DecimalField<Decimal256>>());
case Field::Types::Decimal256:
return visitor(field.template get<DecimalField<Decimal256>>());
default:
LOG(FATAL) << "Bad type of Field";
return {};
Expand Down
10 changes: 5 additions & 5 deletions be/src/vec/core/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ class DecimalField {
return decimal_less_or_equal<MaxType>(dec, r.get_value(), scale, r.get_scale());
}

// template <typename U>
// bool operator==(const DecimalField<U>& r) const {
// using MaxType = std::conditional_t<(sizeof(T) > sizeof(U)), T, U>;
// return decimal_equal<MaxType>(dec, r.get_value(), scale, r.get_scale());
// }
template <typename U>
bool operator==(const DecimalField<U>& r) const {
using MaxType = std::conditional_t<(sizeof(T) > sizeof(U)), T, U>;
return decimal_equal<MaxType>(dec, r.get_value(), scale, r.get_scale());
}

template <typename U>
bool operator>(const DecimalField<U>& r) const {
Expand Down
1 change: 0 additions & 1 deletion be/src/vec/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <vector>

#include "common/consts.h"
#include "gutil/integral_types.h"
#include "util/binary_cast.hpp"
#include "vec/common/int_exp.h"
#include "vec/core/wide_integer.h"
Expand Down

0 comments on commit d0b6295

Please sign in to comment.