[fix](type)support runtime predicate for time type (#38258) (#38465)

## Proposed changes
https://github.com/apache/doris/pull/38258
Issue Number: close #xxx

<!--Describe your changes.-->
This commit is contained in:
Mryange
2024-07-31 10:27:36 +08:00
committed by GitHub
parent 742b98185c
commit 017dad8c54
5 changed files with 93 additions and 0 deletions

View File

@ -28,6 +28,12 @@
namespace doris::vectorized {
std::string get_time_value(const Field& field) {
using ValueType = typename PrimitiveTypeTraits<TYPE_TIMEV2>::CppType;
ValueType value = field.get<ValueType>();
return cast_to_string<TYPE_TIMEV2, ValueType>(value, 0);
}
Status RuntimePredicate::init(PrimitiveType type, bool nulls_first, bool is_asc,
const std::string& col_name) {
std::unique_lock<std::shared_mutex> wlock(_rwlock);
@ -94,6 +100,10 @@ Status RuntimePredicate::init(PrimitiveType type, bool nulls_first, bool is_asc,
_get_value_fn = get_datetime_value;
break;
}
case PrimitiveType::TYPE_TIMEV2: {
_get_value_fn = get_time_value;
break;
}
case PrimitiveType::TYPE_DECIMAL32: {
_get_value_fn = get_decimal_value<TYPE_DECIMAL32>;
break;