be/src/exprs/function/date_time_transforms.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | // This file is copied from |
18 | | // https://github.com/ClickHouse/ClickHouse/blob/master/src/Functions/DateTimeTransforms.h |
19 | | // and modified by Doris |
20 | | |
21 | | #pragma once |
22 | | |
23 | | #include <libdivide.h> |
24 | | |
25 | | #include <cmath> |
26 | | #include <cstdint> |
27 | | |
28 | | #include "common/status.h" |
29 | | #include "core/binary_cast.hpp" |
30 | | #include "core/block/block.h" |
31 | | #include "core/block/column_numbers.h" |
32 | | #include "core/column/column.h" |
33 | | #include "core/column/column_decimal.h" |
34 | | #include "core/column/column_nullable.h" |
35 | | #include "core/column/column_string.h" |
36 | | #include "core/column/column_vector.h" |
37 | | #include "core/data_type/data_type_date.h" |
38 | | #include "core/data_type/data_type_date_time.h" |
39 | | #include "core/data_type/data_type_decimal.h" |
40 | | #include "core/data_type/data_type_string.h" |
41 | | #include "core/data_type/define_primitive_type.h" |
42 | | #include "core/data_type/primitive_type.h" |
43 | | #include "core/types.h" |
44 | | #include "core/value/time_value.h" |
45 | | #include "core/value/vdatetime_value.h" |
46 | | #include "exec/common/int_exp.h" |
47 | | #include "exec/common/util.hpp" |
48 | | #include "exprs/function/date_format_type.h" |
49 | | #include "exprs/function_context.h" |
50 | | |
51 | | // FIXME: This file contains widespread UB due to unsafe type-punning casts. |
52 | | // These must be properly refactored to eliminate reliance on reinterpret-style behavior. |
53 | | // |
54 | | // Temporarily suppress GCC 15+ warnings on user-defined type casts to allow build to proceed. |
55 | | #if defined(__GNUC__) && (__GNUC__ >= 15) |
56 | | #pragma GCC diagnostic push |
57 | | #pragma GCC diagnostic ignored "-Wcast-user-defined" |
58 | | #endif |
59 | | |
60 | | namespace doris { |
61 | | |
62 | | #define TIME_FUNCTION_IMPL(CLASS, UNIT, FUNCTION) \ |
63 | | template <PrimitiveType PType> \ |
64 | | struct CLASS { \ |
65 | | static constexpr PrimitiveType OpArgType = PType; \ |
66 | | using CppType = typename PrimitiveTypeTraits<PType>::CppType; \ |
67 | | static constexpr auto name = #UNIT; \ |
68 | | \ |
69 | 87 | static inline auto execute(const CppType& date_time_value) { \ |
70 | 87 | return date_time_value.FUNCTION; \ |
71 | 87 | } \ _ZN5doris13DayOfWeekImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 1 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 1 | return date_time_value.FUNCTION; \ | 71 | 1 | } \ |
_ZN5doris14DayOfMonthImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris13DayOfYearImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 1 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 1 | return date_time_value.FUNCTION; \ | 71 | 1 | } \ |
_ZN5doris14WeekOfYearImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 1 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 1 | return date_time_value.FUNCTION; \ | 71 | 1 | } \ |
_ZN5doris11WeekDayImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris14WeekOfYearImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 3 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 3 | return date_time_value.FUNCTION; \ | 71 | 3 | } \ |
_ZN5doris13DayOfYearImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris13DayOfWeekImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 5 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 5 | return date_time_value.FUNCTION; \ | 71 | 5 | } \ |
_ZN5doris14DayOfMonthImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
_ZN5doris11WeekDayImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
Unexecuted instantiation: _ZN5doris14WeekOfYearImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris13DayOfYearImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris13DayOfWeekImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris14DayOfMonthImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris11WeekDayImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE _ZN5doris12ToSecondImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 3 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 3 | return date_time_value.FUNCTION; \ | 71 | 3 | } \ |
_ZN5doris12ToMinuteImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 3 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 3 | return date_time_value.FUNCTION; \ | 71 | 3 | } \ |
_ZN5doris10ToHourImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 3 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 3 | return date_time_value.FUNCTION; \ | 71 | 3 | } \ |
_ZN5doris9ToDayImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris11ToMonthImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris10ToYearImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris16ToYearOfWeekImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris13ToQuarterImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
_ZN5doris10ToDaysImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 69 | 2 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 2 | return date_time_value.FUNCTION; \ | 71 | 2 | } \ |
Unexecuted instantiation: _ZN5doris17ToMicroSecondImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE _ZN5doris12ToSecondImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 5 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 5 | return date_time_value.FUNCTION; \ | 71 | 5 | } \ |
_ZN5doris12ToMinuteImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 5 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 5 | return date_time_value.FUNCTION; \ | 71 | 5 | } \ |
_ZN5doris10ToHourImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 5 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 5 | return date_time_value.FUNCTION; \ | 71 | 5 | } \ |
_ZN5doris9ToDayImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
_ZN5doris11ToMonthImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
_ZN5doris10ToYearImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
_ZN5doris13ToQuarterImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
Unexecuted instantiation: _ZN5doris13ToSecondsImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Unexecuted instantiation: _ZN5doris17ToMicroSecondImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris12ToSecondImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE _ZN5doris10ToDaysImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Line | Count | Source | 69 | 3 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 3 | return date_time_value.FUNCTION; \ | 71 | 3 | } \ |
Unexecuted instantiation: _ZN5doris12ToMinuteImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris10ToHourImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris9ToDayImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris11ToMonthImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE _ZN5doris10ToYearImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Line | Count | Source | 69 | 3 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 3 | return date_time_value.FUNCTION; \ | 71 | 3 | } \ |
_ZN5doris16ToYearOfWeekImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Line | Count | Source | 69 | 4 | static inline auto execute(const CppType& date_time_value) { \ | 70 | 4 | return date_time_value.FUNCTION; \ | 71 | 4 | } \ |
Unexecuted instantiation: _ZN5doris13ToQuarterImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Unexecuted instantiation: _ZN5doris13ToSecondsImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
72 | | \ |
73 | 44 | static DataTypes get_variadic_argument_types() { \ |
74 | 44 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ |
75 | 44 | } \ _ZN5doris13DayOfWeekImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris14DayOfMonthImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13DayOfYearImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris14WeekOfYearImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris11WeekDayImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris14WeekOfYearImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13DayOfYearImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13DayOfWeekImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris14DayOfMonthImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris11WeekDayImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris14WeekOfYearImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13DayOfYearImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13DayOfWeekImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris14DayOfMonthImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris11WeekDayImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris12ToSecondImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris12ToMinuteImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToHourImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris9ToDayImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris11ToMonthImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToYearImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris16ToYearOfWeekImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13ToQuarterImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToDaysImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris17ToMicroSecondImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris12ToSecondImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris12ToMinuteImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToHourImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris9ToDayImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris11ToMonthImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToYearImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13ToQuarterImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13ToSecondsImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris17ToMicroSecondImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris12ToSecondImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToDaysImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris12ToMinuteImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToHourImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris9ToDayImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris11ToMonthImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris10ToYearImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris16ToYearOfWeekImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13ToQuarterImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
_ZN5doris13ToSecondsImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 73 | 1 | static DataTypes get_variadic_argument_types() { \ | 74 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 75 | 1 | } \ |
|
76 | | } |
77 | | |
78 | | #define TO_TIME_FUNCTION(CLASS, UNIT) TIME_FUNCTION_IMPL(CLASS, UNIT, UNIT()) |
79 | | |
80 | | TO_TIME_FUNCTION(ToYearImpl, year); |
81 | | template <PrimitiveType PType> |
82 | | struct ToCenturyImpl { |
83 | | static constexpr PrimitiveType OpArgType = PType; |
84 | | using CppType = typename PrimitiveTypeTraits<PType>::CppType; |
85 | | static constexpr auto name = "century"; |
86 | | |
87 | 31 | static inline auto execute(const CppType& t) { |
88 | 31 | const auto& date_time_value = t; |
89 | 31 | int year = date_time_value.year(); |
90 | 31 | return (year - 1) / 100 + 1; |
91 | 31 | } _ZN5doris13ToCenturyImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 87 | 4 | static inline auto execute(const CppType& t) { | 88 | 4 | const auto& date_time_value = t; | 89 | 4 | int year = date_time_value.year(); | 90 | 4 | return (year - 1) / 100 + 1; | 91 | 4 | } |
_ZN5doris13ToCenturyImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 87 | 27 | static inline auto execute(const CppType& t) { | 88 | 27 | const auto& date_time_value = t; | 89 | 27 | int year = date_time_value.year(); | 90 | 27 | return (year - 1) / 100 + 1; | 91 | 27 | } |
Unexecuted instantiation: _ZN5doris13ToCenturyImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
92 | | |
93 | 3 | static DataTypes get_variadic_argument_types() { |
94 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
95 | 3 | } _ZN5doris13ToCenturyImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 93 | 1 | static DataTypes get_variadic_argument_types() { | 94 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 95 | 1 | } |
_ZN5doris13ToCenturyImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 93 | 1 | static DataTypes get_variadic_argument_types() { | 94 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 95 | 1 | } |
_ZN5doris13ToCenturyImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 93 | 1 | static DataTypes get_variadic_argument_types() { | 94 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 95 | 1 | } |
|
96 | | }; |
97 | | TO_TIME_FUNCTION(ToYearOfWeekImpl, year_of_week); |
98 | | TO_TIME_FUNCTION(ToQuarterImpl, quarter); |
99 | | TO_TIME_FUNCTION(ToMonthImpl, month); |
100 | | TO_TIME_FUNCTION(ToDayImpl, day); |
101 | | TO_TIME_FUNCTION(ToHourImpl, hour); |
102 | | TO_TIME_FUNCTION(ToMinuteImpl, minute); |
103 | | TO_TIME_FUNCTION(ToSecondImpl, second); |
104 | | TO_TIME_FUNCTION(ToMicroSecondImpl, microsecond); |
105 | | template <PrimitiveType PType> |
106 | | struct ToNanoSecondImpl { |
107 | | static constexpr PrimitiveType OpArgType = PType; |
108 | | using CppType = typename PrimitiveTypeTraits<PType>::CppType; |
109 | | static constexpr auto name = "nanosecond"; |
110 | | |
111 | 11 | static inline auto execute(const CppType& date_time_value) { |
112 | 11 | if constexpr (PType == TYPE_TIMESTAMP_NS) { |
113 | 4 | return date_time_value.nanosecond(); |
114 | 7 | } else { |
115 | 7 | return static_cast<uint32_t>(date_time_value.microsecond()) * |
116 | 7 | static_cast<uint32_t>(TimeStampNsValue::NANOS_PER_MICROSECOND); |
117 | 7 | } |
118 | 11 | } _ZN5doris16ToNanoSecondImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 111 | 3 | static inline auto execute(const CppType& date_time_value) { | 112 | | if constexpr (PType == TYPE_TIMESTAMP_NS) { | 113 | | return date_time_value.nanosecond(); | 114 | 3 | } else { | 115 | 3 | return static_cast<uint32_t>(date_time_value.microsecond()) * | 116 | 3 | static_cast<uint32_t>(TimeStampNsValue::NANOS_PER_MICROSECOND); | 117 | 3 | } | 118 | 3 | } |
_ZN5doris16ToNanoSecondImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 111 | 4 | static inline auto execute(const CppType& date_time_value) { | 112 | | if constexpr (PType == TYPE_TIMESTAMP_NS) { | 113 | | return date_time_value.nanosecond(); | 114 | 4 | } else { | 115 | 4 | return static_cast<uint32_t>(date_time_value.microsecond()) * | 116 | 4 | static_cast<uint32_t>(TimeStampNsValue::NANOS_PER_MICROSECOND); | 117 | 4 | } | 118 | 4 | } |
_ZN5doris16ToNanoSecondImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Line | Count | Source | 111 | 4 | static inline auto execute(const CppType& date_time_value) { | 112 | 4 | if constexpr (PType == TYPE_TIMESTAMP_NS) { | 113 | 4 | return date_time_value.nanosecond(); | 114 | | } else { | 115 | | return static_cast<uint32_t>(date_time_value.microsecond()) * | 116 | | static_cast<uint32_t>(TimeStampNsValue::NANOS_PER_MICROSECOND); | 117 | | } | 118 | 4 | } |
|
119 | | |
120 | 3 | static DataTypes get_variadic_argument_types() { |
121 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
122 | 3 | } _ZN5doris16ToNanoSecondImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 120 | 1 | static DataTypes get_variadic_argument_types() { | 121 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 122 | 1 | } |
_ZN5doris16ToNanoSecondImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 120 | 1 | static DataTypes get_variadic_argument_types() { | 121 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 122 | 1 | } |
_ZN5doris16ToNanoSecondImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 120 | 1 | static DataTypes get_variadic_argument_types() { | 121 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 122 | 1 | } |
|
123 | | }; |
124 | | |
125 | | TIME_FUNCTION_IMPL(WeekOfYearImpl, weekofyear, week(mysql_week_mode(3))); |
126 | | TIME_FUNCTION_IMPL(DayOfYearImpl, dayofyear, day_of_year()); |
127 | | TIME_FUNCTION_IMPL(DayOfMonthImpl, dayofmonth, day()); |
128 | | TIME_FUNCTION_IMPL(DayOfWeekImpl, dayofweek, day_of_week()); |
129 | | TIME_FUNCTION_IMPL(WeekDayImpl, weekday, weekday()); |
130 | | // TODO: the method should be always not nullable |
131 | | TIME_FUNCTION_IMPL(ToDaysImpl, to_days, daynr()); |
132 | | TIME_FUNCTION_IMPL(ToSecondsImpl, to_seconds, |
133 | | daynr() * 86400L + date_time_value.time_part_to_seconds()); |
134 | | |
135 | | #define TIME_FUNCTION_ONE_ARG_IMPL(CLASS, UNIT, FUNCTION) \ |
136 | | template <PrimitiveType PType> \ |
137 | | struct CLASS { \ |
138 | | static constexpr PrimitiveType OpArgType = PType; \ |
139 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; \ |
140 | | static constexpr auto name = #UNIT; \ |
141 | | \ |
142 | 12 | static inline auto execute(const ArgType& t) { \ |
143 | 12 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ |
144 | 12 | return date_time_value.FUNCTION; \ |
145 | 12 | } \ _ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 142 | 2 | static inline auto execute(const ArgType& t) { \ | 143 | 2 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 144 | 2 | return date_time_value.FUNCTION; \ | 145 | 2 | } \ |
_ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 142 | 4 | static inline auto execute(const ArgType& t) { \ | 143 | 4 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 144 | 4 | return date_time_value.FUNCTION; \ | 145 | 4 | } \ |
Unexecuted instantiation: _ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE _ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 142 | 2 | static inline auto execute(const ArgType& t) { \ | 143 | 2 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 144 | 2 | return date_time_value.FUNCTION; \ | 145 | 2 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 142 | 4 | static inline auto execute(const ArgType& t) { \ | 143 | 4 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 144 | 4 | return date_time_value.FUNCTION; \ | 145 | 4 | } \ |
Unexecuted instantiation: _ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
146 | | \ |
147 | 6 | static DataTypes get_variadic_argument_types() { \ |
148 | 6 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ |
149 | 6 | } \ _ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 147 | 1 | static DataTypes get_variadic_argument_types() { \ | 148 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 149 | 1 | } \ |
_ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 147 | 1 | static DataTypes get_variadic_argument_types() { \ | 148 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 149 | 1 | } \ |
_ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 147 | 1 | static DataTypes get_variadic_argument_types() { \ | 148 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 149 | 1 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 147 | 1 | static DataTypes get_variadic_argument_types() { \ | 148 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 149 | 1 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 147 | 1 | static DataTypes get_variadic_argument_types() { \ | 148 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 149 | 1 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 147 | 1 | static DataTypes get_variadic_argument_types() { \ | 148 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 149 | 1 | } \ |
|
150 | | } |
151 | | |
152 | | TIME_FUNCTION_ONE_ARG_IMPL(ToWeekOneArgImpl, week, week(mysql_week_mode(0))); |
153 | | TIME_FUNCTION_ONE_ARG_IMPL(ToYearWeekOneArgImpl, yearweek, year_week(mysql_week_mode(0))); |
154 | | |
155 | | template <PrimitiveType PType> |
156 | | struct ToDateImpl { |
157 | | static constexpr PrimitiveType OpArgType = PType; |
158 | | using DateType = typename PrimitiveTypeTraits<PType>::CppType; |
159 | | static constexpr auto name = "to_date"; |
160 | | |
161 | 8 | static auto execute(const DateType& t) { |
162 | 8 | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { |
163 | 2 | return t; |
164 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { |
165 | | t.cast_to_date(); |
166 | | return t; |
167 | 3 | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { |
168 | 3 | return t.to_date(); |
169 | 3 | } else { |
170 | 3 | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( |
171 | 3 | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); |
172 | 3 | } |
173 | 8 | } _ZN5doris10ToDateImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 161 | 2 | static auto execute(const DateType& t) { | 162 | 2 | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { | 163 | 2 | return t; | 164 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { | 165 | | t.cast_to_date(); | 166 | | return t; | 167 | | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { | 168 | | return t.to_date(); | 169 | | } else { | 170 | | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( | 171 | | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); | 172 | | } | 173 | 2 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 161 | 3 | static auto execute(const DateType& t) { | 162 | | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { | 163 | | return t; | 164 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { | 165 | | t.cast_to_date(); | 166 | | return t; | 167 | | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { | 168 | | return t.to_date(); | 169 | 3 | } else { | 170 | 3 | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( | 171 | 3 | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); | 172 | 3 | } | 173 | 3 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE Line | Count | Source | 161 | 3 | static auto execute(const DateType& t) { | 162 | | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { | 163 | | return t; | 164 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { | 165 | | t.cast_to_date(); | 166 | | return t; | 167 | 3 | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { | 168 | 3 | return t.to_date(); | 169 | | } else { | 170 | | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( | 171 | | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); | 172 | | } | 173 | 3 | } |
|
174 | | |
175 | 6 | static DataTypes get_variadic_argument_types() { |
176 | 6 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
177 | 6 | } _ZN5doris10ToDateImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 175 | 2 | static DataTypes get_variadic_argument_types() { | 176 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 177 | 2 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 175 | 2 | static DataTypes get_variadic_argument_types() { | 176 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 177 | 2 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 175 | 2 | static DataTypes get_variadic_argument_types() { | 176 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 177 | 2 | } |
|
178 | | }; |
179 | | |
180 | | template <PrimitiveType ArgType> |
181 | | struct DateImpl : public ToDateImpl<ArgType> { |
182 | | static constexpr auto name = "date"; |
183 | | }; |
184 | | |
185 | | // TODO: This function look like no need do indeed copy here, we should optimize this function |
186 | | template <PrimitiveType PType> |
187 | | struct TimeStampImpl { |
188 | | static constexpr PrimitiveType OpArgType = PType; |
189 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
190 | | static constexpr auto name = "timestamp"; |
191 | | |
192 | 0 | static auto execute(const ArgType& t) { return t; }Unexecuted instantiation: _ZN5doris13TimeStampImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Unexecuted instantiation: _ZN5doris13TimeStampImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
193 | | |
194 | 2 | static DataTypes get_variadic_argument_types() { |
195 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
196 | 2 | } _ZN5doris13TimeStampImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 194 | 1 | static DataTypes get_variadic_argument_types() { | 195 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 196 | 1 | } |
_ZN5doris13TimeStampImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 194 | 1 | static DataTypes get_variadic_argument_types() { | 195 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 196 | 1 | } |
|
197 | | }; |
198 | | |
199 | | template <PrimitiveType PType> |
200 | | struct DayNameImpl { |
201 | | static constexpr PrimitiveType OpArgType = PType; |
202 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
203 | | static constexpr auto name = "dayname"; |
204 | | static constexpr auto max_size = MAX_DAY_NAME_LEN; |
205 | | |
206 | | static auto execute(const typename PrimitiveTypeTraits<PType>::CppType& dt, |
207 | | ColumnString::Chars& res_data, size_t& offset, const char* const* day_names, |
208 | 3 | FunctionContext* /*context*/) { |
209 | 3 | DCHECK(day_names != nullptr); |
210 | 3 | const auto* day_name = dt.day_name_with_locale(day_names); |
211 | 3 | if (day_name != nullptr) { |
212 | 3 | auto len = strlen(day_name); |
213 | 3 | memcpy(&res_data[offset], day_name, len); |
214 | 3 | offset += len; |
215 | 3 | } |
216 | 3 | return offset; |
217 | 3 | } _ZN5doris11DayNameImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Line | Count | Source | 208 | 1 | FunctionContext* /*context*/) { | 209 | 1 | DCHECK(day_names != nullptr); | 210 | 1 | const auto* day_name = dt.day_name_with_locale(day_names); | 211 | 1 | if (day_name != nullptr) { | 212 | 1 | auto len = strlen(day_name); | 213 | 1 | memcpy(&res_data[offset], day_name, len); | 214 | 1 | offset += len; | 215 | 1 | } | 216 | 1 | return offset; | 217 | 1 | } |
_ZN5doris11DayNameImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Line | Count | Source | 208 | 2 | FunctionContext* /*context*/) { | 209 | 2 | DCHECK(day_names != nullptr); | 210 | 2 | const auto* day_name = dt.day_name_with_locale(day_names); | 211 | 2 | if (day_name != nullptr) { | 212 | 2 | auto len = strlen(day_name); | 213 | 2 | memcpy(&res_data[offset], day_name, len); | 214 | 2 | offset += len; | 215 | 2 | } | 216 | 2 | return offset; | 217 | 2 | } |
Unexecuted instantiation: _ZN5doris11DayNameImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE |
218 | | |
219 | 3 | static DataTypes get_variadic_argument_types() { |
220 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
221 | 3 | } _ZN5doris11DayNameImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 219 | 1 | static DataTypes get_variadic_argument_types() { | 220 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 221 | 1 | } |
_ZN5doris11DayNameImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 219 | 1 | static DataTypes get_variadic_argument_types() { | 220 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 221 | 1 | } |
_ZN5doris11DayNameImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 219 | 1 | static DataTypes get_variadic_argument_types() { | 220 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 221 | 1 | } |
|
222 | | }; |
223 | | |
224 | | template <PrimitiveType PType> |
225 | | struct ToIso8601Impl { |
226 | | static constexpr PrimitiveType OpArgType = PType; |
227 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
228 | | static constexpr auto name = "to_iso8601"; |
229 | | static constexpr auto max_size = [] { |
230 | | if constexpr (PType == TYPE_DATEV2) { |
231 | | return 10; |
232 | | } else if constexpr (PType == TYPE_TIMESTAMP_NS) { |
233 | | return 29; |
234 | | } else { |
235 | | return 26; |
236 | | } |
237 | | }(); |
238 | | |
239 | | static auto execute(const typename PrimitiveTypeTraits<PType>::CppType& dt, |
240 | | ColumnString::Chars& res_data, size_t& offset, |
241 | 0 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { |
242 | 0 | int length = 0; |
243 | 0 | if constexpr (PType == TYPE_TIMESTAMP_NS) { |
244 | 0 | length = dt.to_buffer((char*)res_data.data() + offset); |
245 | 0 | } else { |
246 | 0 | constexpr int scale = PType == TYPE_DATEV2 ? -1 : 6; |
247 | 0 | length = dt.to_buffer((char*)res_data.data() + offset, scale); |
248 | 0 | } |
249 | 0 | if (PType == TYPE_DATETIMEV2 || PType == TYPE_TIMESTAMP_NS || PType == TYPE_TIMESTAMPTZ) { |
250 | 0 | res_data[offset + 10] = 'T'; |
251 | 0 | } |
252 | |
|
253 | 0 | offset += length; |
254 | 0 | return offset; |
255 | 0 | } Unexecuted instantiation: _ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Unexecuted instantiation: _ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Unexecuted instantiation: _ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE |
256 | | |
257 | 3 | static DataTypes get_variadic_argument_types() { |
258 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
259 | 3 | } _ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 257 | 1 | static DataTypes get_variadic_argument_types() { | 258 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 259 | 1 | } |
_ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 257 | 1 | static DataTypes get_variadic_argument_types() { | 258 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 259 | 1 | } |
_ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 257 | 1 | static DataTypes get_variadic_argument_types() { | 258 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 259 | 1 | } |
|
260 | | }; |
261 | | |
262 | | // Specialization for TIMESTAMPTZ type |
263 | | template <> |
264 | | struct ToIso8601Impl<TYPE_TIMESTAMPTZ> { |
265 | | static constexpr PrimitiveType OpArgType = TYPE_TIMESTAMPTZ; |
266 | | using ArgType = typename PrimitiveTypeTraits<TYPE_TIMESTAMPTZ>::CppType; |
267 | | static constexpr auto name = "to_iso8601"; |
268 | | // Format: YYYY-MM-DDTHH:MM:SS.SSSSSS+HH:MM |
269 | | static constexpr auto max_size = 32; |
270 | | |
271 | | static auto execute(const TimestampTzValue& tz_value, ColumnString::Chars& res_data, |
272 | | size_t& offset, const char* const* /*names_ptr*/, |
273 | 0 | FunctionContext* context) { |
274 | | // Get timezone |
275 | 0 | const auto& local_time_zone = context->state()->timezone_obj(); |
276 | | |
277 | | // Convert UTC time to local time |
278 | 0 | cctz::civil_second utc_sec(tz_value.year(), tz_value.month(), tz_value.day(), |
279 | 0 | tz_value.hour(), tz_value.minute(), tz_value.second()); |
280 | 0 | cctz::time_point<cctz::seconds> local_time = cctz::convert(utc_sec, cctz::utc_time_zone()); |
281 | |
|
282 | 0 | auto lookup_result = local_time_zone.lookup(local_time); |
283 | 0 | cctz::civil_second civ = lookup_result.cs; |
284 | 0 | auto time_offset = lookup_result.offset; |
285 | |
|
286 | 0 | int offset_hours = time_offset / 3600; |
287 | 0 | int offset_mins = (std::abs(time_offset) % 3600) / 60; |
288 | | |
289 | | // Create local datetime value |
290 | 0 | DateV2Value<DateTimeV2ValueType> local_dt; |
291 | 0 | local_dt.unchecked_set_time((uint16_t)civ.year(), (uint8_t)civ.month(), (uint8_t)civ.day(), |
292 | 0 | (uint8_t)civ.hour(), (uint8_t)civ.minute(), |
293 | 0 | (uint8_t)civ.second(), tz_value.microsecond()); |
294 | | |
295 | | // YYYY-MM-DDTHH:MM:SS.SSSSSS+HH:MM |
296 | 0 | auto length = local_dt.to_buffer((char*)res_data.data() + offset, 6); |
297 | 0 | res_data[offset + 10] = 'T'; |
298 | 0 | res_data[offset + length] = (offset_hours >= 0 ? '+' : '-'); |
299 | 0 | res_data[offset + length + 1] = static_cast<char>('0' + std::abs(offset_hours) / 10); |
300 | 0 | res_data[offset + length + 2] = '0' + std::abs(offset_hours) % 10; |
301 | 0 | res_data[offset + length + 3] = ':'; |
302 | 0 | res_data[offset + length + 4] = static_cast<char>('0' + offset_mins / 10); |
303 | 0 | res_data[offset + length + 5] = '0' + offset_mins % 10; |
304 | |
|
305 | 0 | offset += length + 6; |
306 | 0 | return offset; |
307 | 0 | } |
308 | | |
309 | 1 | static DataTypes get_variadic_argument_types() { |
310 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<TYPE_TIMESTAMPTZ>::DataType>()}; |
311 | 1 | } |
312 | | }; |
313 | | |
314 | | template <PrimitiveType PType> |
315 | | struct MonthNameImpl { |
316 | | static constexpr PrimitiveType OpArgType = PType; |
317 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
318 | | static constexpr auto name = "monthname"; |
319 | | static constexpr auto max_size = MAX_MONTH_NAME_LEN; |
320 | | |
321 | | static auto execute(const typename PrimitiveTypeTraits<PType>::CppType& dt, |
322 | | ColumnString::Chars& res_data, size_t& offset, |
323 | 0 | const char* const* month_names, FunctionContext* /*context*/) { |
324 | 0 | DCHECK(month_names != nullptr); |
325 | 0 | const auto* month_name = dt.month_name_with_locale(month_names); |
326 | 0 | if (month_name != nullptr) { |
327 | 0 | auto len = strlen(month_name); |
328 | 0 | memcpy(&res_data[offset], month_name, len); |
329 | 0 | offset += len; |
330 | 0 | } |
331 | 0 | return offset; |
332 | 0 | } Unexecuted instantiation: _ZN5doris13MonthNameImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Unexecuted instantiation: _ZN5doris13MonthNameImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Unexecuted instantiation: _ZN5doris13MonthNameImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE |
333 | | |
334 | 3 | static DataTypes get_variadic_argument_types() { |
335 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
336 | 3 | } _ZN5doris13MonthNameImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 334 | 1 | static DataTypes get_variadic_argument_types() { | 335 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 336 | 1 | } |
_ZN5doris13MonthNameImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 334 | 1 | static DataTypes get_variadic_argument_types() { | 335 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 336 | 1 | } |
_ZN5doris13MonthNameImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 334 | 1 | static DataTypes get_variadic_argument_types() { | 335 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 336 | 1 | } |
|
337 | | }; |
338 | | |
339 | | template <PrimitiveType PType, typename FormatImpl, const char* FuncName> |
340 | | struct DateTimeV2FormatImpl { |
341 | | static_assert(PType == TYPE_DATETIMEV2 || PType == TYPE_TIMESTAMP_NS); |
342 | | static constexpr PrimitiveType OpArgType = PType; |
343 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
344 | | static constexpr auto name = FuncName; |
345 | | static constexpr auto max_size = FormatImpl::row_size; |
346 | | |
347 | | static auto execute(const ArgType& dt, ColumnString::Chars& res_data, size_t& offset, |
348 | 2 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { |
349 | 2 | auto* buf = reinterpret_cast<char*>(&res_data[offset]); |
350 | 2 | constexpr bool needs_civil_datetime = |
351 | 2 | std::is_same_v<FormatImpl, time_format_type::dd_HHImpl> || |
352 | 2 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mmImpl> || |
353 | 2 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mm_ssImpl> || |
354 | 2 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mm_ss_SSSSSSImpl>; |
355 | | if constexpr (PType == TYPE_TIMESTAMP_NS && |
356 | 1 | std::is_same_v<FormatImpl, time_format_type::yyyy_MMImpl>) { |
357 | 1 | const auto civil_value = dt.to_date(); |
358 | 1 | offset += FormatImpl::date_to_str(civil_value, buf); |
359 | 1 | } else if constexpr (PType == TYPE_TIMESTAMP_NS && needs_civil_datetime) { |
360 | 1 | const auto civil_value = dt.to_datetime(); |
361 | 1 | offset += FormatImpl::date_to_str(civil_value, buf); |
362 | 1 | } else { |
363 | 0 | offset += FormatImpl::date_to_str(dt, buf); |
364 | 0 | } |
365 | 2 | return offset; |
366 | 2 | } Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type11yyyy_MMImplEXadsoKcL_ZNS_14kYearMonthNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9dd_HHImplEXadsoKcL_ZNS_12kDayHourNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type12dd_HH_mmImplEXadsoKcL_ZNS_14kDayMinuteNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type15dd_HH_mm_ssImplEXadsoKcL_ZNS_14kDaySecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type22dd_HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_19kDayMicrosecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9HH_mmImplEXadsoKcL_ZNS_15kHourMinuteNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type12HH_mm_ssImplEXadsoKcL_ZNS_15kHourSecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type19HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_20kHourMicrosecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9mm_ssImplEXadsoKcL_ZNS_17kMinuteSecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type16mm_ss_SSSSSSImplEXadsoKcL_ZNS_22kMinuteMicrosecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type13ss_SSSSSSImplEXadsoKcL_ZNS_22kSecondMicrosecondNameEEEEE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type11yyyy_MMImplEXadsoKcL_ZNS_14kYearMonthNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Line | Count | Source | 348 | 1 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { | 349 | 1 | auto* buf = reinterpret_cast<char*>(&res_data[offset]); | 350 | 1 | constexpr bool needs_civil_datetime = | 351 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HHImpl> || | 352 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mmImpl> || | 353 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mm_ssImpl> || | 354 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mm_ss_SSSSSSImpl>; | 355 | | if constexpr (PType == TYPE_TIMESTAMP_NS && | 356 | 1 | std::is_same_v<FormatImpl, time_format_type::yyyy_MMImpl>) { | 357 | 1 | const auto civil_value = dt.to_date(); | 358 | 1 | offset += FormatImpl::date_to_str(civil_value, buf); | 359 | | } else if constexpr (PType == TYPE_TIMESTAMP_NS && needs_civil_datetime) { | 360 | | const auto civil_value = dt.to_datetime(); | 361 | | offset += FormatImpl::date_to_str(civil_value, buf); | 362 | | } else { | 363 | | offset += FormatImpl::date_to_str(dt, buf); | 364 | | } | 365 | 1 | return offset; | 366 | 1 | } |
Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9dd_HHImplEXadsoKcL_ZNS_12kDayHourNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type12dd_HH_mmImplEXadsoKcL_ZNS_14kDayMinuteNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type15dd_HH_mm_ssImplEXadsoKcL_ZNS_14kDaySecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type22dd_HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_19kDayMicrosecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Line | Count | Source | 348 | 1 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { | 349 | 1 | auto* buf = reinterpret_cast<char*>(&res_data[offset]); | 350 | 1 | constexpr bool needs_civil_datetime = | 351 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HHImpl> || | 352 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mmImpl> || | 353 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mm_ssImpl> || | 354 | 1 | std::is_same_v<FormatImpl, time_format_type::dd_HH_mm_ss_SSSSSSImpl>; | 355 | | if constexpr (PType == TYPE_TIMESTAMP_NS && | 356 | | std::is_same_v<FormatImpl, time_format_type::yyyy_MMImpl>) { | 357 | | const auto civil_value = dt.to_date(); | 358 | | offset += FormatImpl::date_to_str(civil_value, buf); | 359 | 1 | } else if constexpr (PType == TYPE_TIMESTAMP_NS && needs_civil_datetime) { | 360 | 1 | const auto civil_value = dt.to_datetime(); | 361 | 1 | offset += FormatImpl::date_to_str(civil_value, buf); | 362 | | } else { | 363 | | offset += FormatImpl::date_to_str(dt, buf); | 364 | | } | 365 | 1 | return offset; | 366 | 1 | } |
Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9HH_mmImplEXadsoKcL_ZNS_15kHourMinuteNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type12HH_mm_ssImplEXadsoKcL_ZNS_15kHourSecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type19HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_20kHourMicrosecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9mm_ssImplEXadsoKcL_ZNS_17kMinuteSecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type16mm_ss_SSSSSSImplEXadsoKcL_ZNS_22kMinuteMicrosecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE Unexecuted instantiation: _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type13ss_SSSSSSImplEXadsoKcL_ZNS_22kSecondMicrosecondNameEEEEE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPS4_PNS_15FunctionContextE |
367 | | |
368 | 22 | static DataTypes get_variadic_argument_types() { |
369 | 22 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
370 | 22 | } _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type11yyyy_MMImplEXadsoKcL_ZNS_14kYearMonthNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9dd_HHImplEXadsoKcL_ZNS_12kDayHourNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type12dd_HH_mmImplEXadsoKcL_ZNS_14kDayMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type15dd_HH_mm_ssImplEXadsoKcL_ZNS_14kDaySecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type22dd_HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_19kDayMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9HH_mmImplEXadsoKcL_ZNS_15kHourMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type12HH_mm_ssImplEXadsoKcL_ZNS_15kHourSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type19HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_20kHourMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9mm_ssImplEXadsoKcL_ZNS_17kMinuteSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type16mm_ss_SSSSSSImplEXadsoKcL_ZNS_22kMinuteMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type13ss_SSSSSSImplEXadsoKcL_ZNS_22kSecondMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type11yyyy_MMImplEXadsoKcL_ZNS_14kYearMonthNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9dd_HHImplEXadsoKcL_ZNS_12kDayHourNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type12dd_HH_mmImplEXadsoKcL_ZNS_14kDayMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type15dd_HH_mm_ssImplEXadsoKcL_ZNS_14kDaySecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type22dd_HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_19kDayMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9HH_mmImplEXadsoKcL_ZNS_15kHourMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type12HH_mm_ssImplEXadsoKcL_ZNS_15kHourSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type19HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_20kHourMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9mm_ssImplEXadsoKcL_ZNS_17kMinuteSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type16mm_ss_SSSSSSImplEXadsoKcL_ZNS_22kMinuteMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type13ss_SSSSSSImplEXadsoKcL_ZNS_22kSecondMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 368 | 1 | static DataTypes get_variadic_argument_types() { | 369 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 370 | 1 | } |
|
371 | | }; |
372 | | |
373 | | inline constexpr char kYearMonthName[] = "year_month"; |
374 | | inline constexpr char kDayHourName[] = "day_hour"; |
375 | | inline constexpr char kDayMinuteName[] = "day_minute"; |
376 | | inline constexpr char kDaySecondName[] = "day_second"; |
377 | | inline constexpr char kDayMicrosecondName[] = "day_microsecond"; |
378 | | inline constexpr char kHourMinuteName[] = "hour_minute"; |
379 | | inline constexpr char kHourSecondName[] = "hour_second"; |
380 | | inline constexpr char kHourMicrosecondName[] = "hour_microsecond"; |
381 | | inline constexpr char kMinuteSecondName[] = "minute_second"; |
382 | | inline constexpr char kMinuteMicrosecondName[] = "minute_microsecond"; |
383 | | inline constexpr char kSecondMicrosecondName[] = "second_microsecond"; |
384 | | |
385 | | template <PrimitiveType PType> |
386 | | using YearMonthImpl = DateTimeV2FormatImpl<PType, time_format_type::yyyy_MMImpl, kYearMonthName>; |
387 | | template <PrimitiveType PType> |
388 | | using DayHourImpl = DateTimeV2FormatImpl<PType, time_format_type::dd_HHImpl, kDayHourName>; |
389 | | template <PrimitiveType PType> |
390 | | using DayMinuteImpl = DateTimeV2FormatImpl<PType, time_format_type::dd_HH_mmImpl, kDayMinuteName>; |
391 | | template <PrimitiveType PType> |
392 | | using DaySecondImpl = |
393 | | DateTimeV2FormatImpl<PType, time_format_type::dd_HH_mm_ssImpl, kDaySecondName>; |
394 | | template <PrimitiveType PType> |
395 | | using DayMicrosecondImpl = |
396 | | DateTimeV2FormatImpl<PType, time_format_type::dd_HH_mm_ss_SSSSSSImpl, kDayMicrosecondName>; |
397 | | template <PrimitiveType PType> |
398 | | using HourMinuteImpl = DateTimeV2FormatImpl<PType, time_format_type::HH_mmImpl, kHourMinuteName>; |
399 | | template <PrimitiveType PType> |
400 | | using HourSecondImpl = DateTimeV2FormatImpl<PType, time_format_type::HH_mm_ssImpl, kHourSecondName>; |
401 | | template <PrimitiveType PType> |
402 | | using HourMicrosecondImpl = |
403 | | DateTimeV2FormatImpl<PType, time_format_type::HH_mm_ss_SSSSSSImpl, kHourMicrosecondName>; |
404 | | template <PrimitiveType PType> |
405 | | using MinuteSecondImpl = |
406 | | DateTimeV2FormatImpl<PType, time_format_type::mm_ssImpl, kMinuteSecondName>; |
407 | | template <PrimitiveType PType> |
408 | | using MinuteMicrosecondImpl = |
409 | | DateTimeV2FormatImpl<PType, time_format_type::mm_ss_SSSSSSImpl, kMinuteMicrosecondName>; |
410 | | template <PrimitiveType PType> |
411 | | using SecondMicrosecondImpl = |
412 | | DateTimeV2FormatImpl<PType, time_format_type::ss_SSSSSSImpl, kSecondMicrosecondName>; |
413 | | |
414 | | template <PrimitiveType PType> |
415 | | struct DateFormatImpl { |
416 | | using DateType = typename PrimitiveTypeTraits<PType>::CppType; |
417 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
418 | | static constexpr PrimitiveType FromPType = PType; |
419 | | |
420 | | static constexpr auto name = "date_format"; |
421 | | |
422 | | template <typename Impl> |
423 | | static bool execute(const DateType& dt, StringRef format, ColumnString::Chars& res_data, |
424 | 26 | size_t& offset, const cctz::time_zone& time_zone) { |
425 | 26 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { |
426 | | // Handle non-special formats. |
427 | 26 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
428 | 26 | const bool formatted = [&]() { |
429 | 26 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { |
430 | 17 | return dt.to_format_string_conservative( |
431 | 17 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, |
432 | 17 | static_cast<int>(dt.microsecond()) * 1000); |
433 | 17 | } else { |
434 | 9 | return dt.to_format_string_conservative(format.data, format.size, buf, |
435 | 9 | 100 + SAFE_FORMAT_STRING_MARGIN); |
436 | 9 | } |
437 | 26 | }(); _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Line | Count | Source | 428 | 6 | const bool formatted = [&]() { | 429 | | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 430 | | return dt.to_format_string_conservative( | 431 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 432 | | static_cast<int>(dt.microsecond()) * 1000); | 433 | 6 | } else { | 434 | 6 | return dt.to_format_string_conservative(format.data, format.size, buf, | 435 | 6 | 100 + SAFE_FORMAT_STRING_MARGIN); | 436 | 6 | } | 437 | 6 | }(); |
_ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Line | Count | Source | 428 | 17 | const bool formatted = [&]() { | 429 | 17 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 430 | 17 | return dt.to_format_string_conservative( | 431 | 17 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 432 | 17 | static_cast<int>(dt.microsecond()) * 1000); | 433 | | } else { | 434 | | return dt.to_format_string_conservative(format.data, format.size, buf, | 435 | | 100 + SAFE_FORMAT_STRING_MARGIN); | 436 | | } | 437 | 17 | }(); |
_ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Line | Count | Source | 428 | 3 | const bool formatted = [&]() { | 429 | | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 430 | | return dt.to_format_string_conservative( | 431 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 432 | | static_cast<int>(dt.microsecond()) * 1000); | 433 | 3 | } else { | 434 | 3 | return dt.to_format_string_conservative(format.data, format.size, buf, | 435 | 3 | 100 + SAFE_FORMAT_STRING_MARGIN); | 436 | 3 | } | 437 | 3 | }(); |
|
438 | 26 | if (!formatted) { |
439 | 0 | return true; |
440 | 0 | } |
441 | | |
442 | 26 | auto len = strlen(buf); |
443 | 26 | res_data.insert(buf, buf + len); |
444 | 26 | offset += len; |
445 | 26 | return false; |
446 | 26 | } else { |
447 | 0 | if (!dt.is_valid_date()) { |
448 | 0 | return true; |
449 | 0 | } |
450 | | |
451 | | // No buffer is needed here because these specially optimized formats have fixed lengths, |
452 | | // and sufficient memory has already been reserved. |
453 | 0 | const auto len = [&]() { |
454 | 0 | if constexpr (PType == TYPE_TIMESTAMP_NS) { |
455 | 0 | constexpr bool needs_civil_time = |
456 | 0 | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ssImpl> || |
457 | 0 | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl>; |
458 | 0 | const auto civil_value = [&]() { |
459 | 0 | if constexpr (needs_civil_time) { |
460 | 0 | return dt.to_datetime(); |
461 | 0 | } else { |
462 | 0 | return dt.to_date(); |
463 | 0 | } |
464 | 0 | }(); Unexecuted instantiation: _ZZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: _ZZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: _ZZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: _ZZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: _ZZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEvENKUlvE_clEv Unexecuted instantiation: _ZZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEvENKUlvE_clEv |
465 | 0 | return Impl::date_to_str(civil_value, (char*)res_data.data() + offset); |
466 | 0 | } else { |
467 | 0 | return Impl::date_to_str(dt, (char*)res_data.data() + offset); |
468 | 0 | } |
469 | 0 | }(); Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Unexecuted instantiation: _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv |
470 | 0 | offset += len; |
471 | |
|
472 | 0 | return false; |
473 | 0 | } |
474 | 26 | } _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 424 | 6 | size_t& offset, const cctz::time_zone& time_zone) { | 425 | 6 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 426 | | // Handle non-special formats. | 427 | 6 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 428 | 6 | const bool formatted = [&]() { | 429 | 6 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 430 | 6 | return dt.to_format_string_conservative( | 431 | 6 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 432 | 6 | static_cast<int>(dt.microsecond()) * 1000); | 433 | 6 | } else { | 434 | 6 | return dt.to_format_string_conservative(format.data, format.size, buf, | 435 | 6 | 100 + SAFE_FORMAT_STRING_MARGIN); | 436 | 6 | } | 437 | 6 | }(); | 438 | 6 | if (!formatted) { | 439 | 0 | return true; | 440 | 0 | } | 441 | | | 442 | 6 | auto len = strlen(buf); | 443 | 6 | res_data.insert(buf, buf + len); | 444 | 6 | offset += len; | 445 | 6 | return false; | 446 | | } else { | 447 | | if (!dt.is_valid_date()) { | 448 | | return true; | 449 | | } | 450 | | | 451 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 452 | | // and sufficient memory has already been reserved. | 453 | | const auto len = [&]() { | 454 | | if constexpr (PType == TYPE_TIMESTAMP_NS) { | 455 | | constexpr bool needs_civil_time = | 456 | | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ssImpl> || | 457 | | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl>; | 458 | | const auto civil_value = [&]() { | 459 | | if constexpr (needs_civil_time) { | 460 | | return dt.to_datetime(); | 461 | | } else { | 462 | | return dt.to_date(); | 463 | | } | 464 | | }(); | 465 | | return Impl::date_to_str(civil_value, (char*)res_data.data() + offset); | 466 | | } else { | 467 | | return Impl::date_to_str(dt, (char*)res_data.data() + offset); | 468 | | } | 469 | | }(); | 470 | | offset += len; | 471 | | | 472 | | return false; | 473 | | } | 474 | 6 | } |
Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 424 | 17 | size_t& offset, const cctz::time_zone& time_zone) { | 425 | 17 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 426 | | // Handle non-special formats. | 427 | 17 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 428 | 17 | const bool formatted = [&]() { | 429 | 17 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 430 | 17 | return dt.to_format_string_conservative( | 431 | 17 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 432 | 17 | static_cast<int>(dt.microsecond()) * 1000); | 433 | 17 | } else { | 434 | 17 | return dt.to_format_string_conservative(format.data, format.size, buf, | 435 | 17 | 100 + SAFE_FORMAT_STRING_MARGIN); | 436 | 17 | } | 437 | 17 | }(); | 438 | 17 | if (!formatted) { | 439 | 0 | return true; | 440 | 0 | } | 441 | | | 442 | 17 | auto len = strlen(buf); | 443 | 17 | res_data.insert(buf, buf + len); | 444 | 17 | offset += len; | 445 | 17 | return false; | 446 | | } else { | 447 | | if (!dt.is_valid_date()) { | 448 | | return true; | 449 | | } | 450 | | | 451 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 452 | | // and sufficient memory has already been reserved. | 453 | | const auto len = [&]() { | 454 | | if constexpr (PType == TYPE_TIMESTAMP_NS) { | 455 | | constexpr bool needs_civil_time = | 456 | | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ssImpl> || | 457 | | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl>; | 458 | | const auto civil_value = [&]() { | 459 | | if constexpr (needs_civil_time) { | 460 | | return dt.to_datetime(); | 461 | | } else { | 462 | | return dt.to_date(); | 463 | | } | 464 | | }(); | 465 | | return Impl::date_to_str(civil_value, (char*)res_data.data() + offset); | 466 | | } else { | 467 | | return Impl::date_to_str(dt, (char*)res_data.data() + offset); | 468 | | } | 469 | | }(); | 470 | | offset += len; | 471 | | | 472 | | return false; | 473 | | } | 474 | 17 | } |
Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 424 | 3 | size_t& offset, const cctz::time_zone& time_zone) { | 425 | 3 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 426 | | // Handle non-special formats. | 427 | 3 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 428 | 3 | const bool formatted = [&]() { | 429 | 3 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 430 | 3 | return dt.to_format_string_conservative( | 431 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 432 | 3 | static_cast<int>(dt.microsecond()) * 1000); | 433 | 3 | } else { | 434 | 3 | return dt.to_format_string_conservative(format.data, format.size, buf, | 435 | 3 | 100 + SAFE_FORMAT_STRING_MARGIN); | 436 | 3 | } | 437 | 3 | }(); | 438 | 3 | if (!formatted) { | 439 | 0 | return true; | 440 | 0 | } | 441 | | | 442 | 3 | auto len = strlen(buf); | 443 | 3 | res_data.insert(buf, buf + len); | 444 | 3 | offset += len; | 445 | 3 | return false; | 446 | | } else { | 447 | | if (!dt.is_valid_date()) { | 448 | | return true; | 449 | | } | 450 | | | 451 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 452 | | // and sufficient memory has already been reserved. | 453 | | const auto len = [&]() { | 454 | | if constexpr (PType == TYPE_TIMESTAMP_NS) { | 455 | | constexpr bool needs_civil_time = | 456 | | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ssImpl> || | 457 | | std::is_same_v<Impl, time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl>; | 458 | | const auto civil_value = [&]() { | 459 | | if constexpr (needs_civil_time) { | 460 | | return dt.to_datetime(); | 461 | | } else { | 462 | | return dt.to_date(); | 463 | | } | 464 | | }(); | 465 | | return Impl::date_to_str(civil_value, (char*)res_data.data() + offset); | 466 | | } else { | 467 | | return Impl::date_to_str(dt, (char*)res_data.data() + offset); | 468 | | } | 469 | | }(); | 470 | | offset += len; | 471 | | | 472 | | return false; | 473 | | } | 474 | 3 | } |
Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type10yyyyMMImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type8yyyyImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE |
475 | | |
476 | 3 | static DataTypes get_variadic_argument_types() { |
477 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), |
478 | 3 | std::make_shared<DataTypeString>()}; |
479 | 3 | } _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 476 | 1 | static DataTypes get_variadic_argument_types() { | 477 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), | 478 | 1 | std::make_shared<DataTypeString>()}; | 479 | 1 | } |
_ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 476 | 1 | static DataTypes get_variadic_argument_types() { | 477 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), | 478 | 1 | std::make_shared<DataTypeString>()}; | 479 | 1 | } |
_ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 476 | 1 | static DataTypes get_variadic_argument_types() { | 477 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), | 478 | 1 | std::make_shared<DataTypeString>()}; | 479 | 1 | } |
|
480 | | }; |
481 | | |
482 | 40 | inline bool contains_from_unixtime_format_specifier(StringRef format, char specifier) { |
483 | 335 | for (size_t i = 0; i + 1 < format.size; ++i) { |
484 | | // Consume the character after every '%', so "%%n" is escaped text rather than %n. |
485 | 312 | if (format.data[i] == '%' && format.data[++i] == specifier) { |
486 | 17 | return true; |
487 | 17 | } |
488 | 312 | } |
489 | 23 | return false; |
490 | 40 | } |
491 | | |
492 | 17 | inline bool has_conflicting_from_unixtime_fraction_specifiers(StringRef format) { |
493 | | // %f formats the microsecond-rounded instant, while %n formats the original nanosecond |
494 | | // instant. For example, 0.999999500 becomes 1.000000 for %f but stays 0.999999500 for %n, |
495 | | // so one result cannot contain both fields consistently. |
496 | 17 | return contains_from_unixtime_format_specifier(format, 'f') && |
497 | 17 | contains_from_unixtime_format_specifier(format, 'n'); |
498 | 17 | } |
499 | | |
500 | | template <bool WithStringArg, bool NewVersion = false> |
501 | | struct FromUnixTimeImpl { |
502 | | using ArgType = Int64; |
503 | | static constexpr PrimitiveType FromPType = TYPE_BIGINT; |
504 | | |
505 | 4 | static DataTypes get_variadic_argument_types() { |
506 | 4 | if constexpr (WithStringArg) { |
507 | 2 | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; |
508 | 2 | } else { |
509 | 2 | return {std::make_shared<DataTypeInt64>()}; |
510 | 2 | } |
511 | 4 | } _ZN5doris16FromUnixTimeImplILb0ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 505 | 1 | static DataTypes get_variadic_argument_types() { | 506 | | if constexpr (WithStringArg) { | 507 | | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 508 | 1 | } else { | 509 | 1 | return {std::make_shared<DataTypeInt64>()}; | 510 | 1 | } | 511 | 1 | } |
_ZN5doris16FromUnixTimeImplILb1ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 505 | 1 | static DataTypes get_variadic_argument_types() { | 506 | 1 | if constexpr (WithStringArg) { | 507 | 1 | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 508 | | } else { | 509 | | return {std::make_shared<DataTypeInt64>()}; | 510 | | } | 511 | 1 | } |
_ZN5doris16FromUnixTimeImplILb0ELb1EE27get_variadic_argument_typesEv Line | Count | Source | 505 | 1 | static DataTypes get_variadic_argument_types() { | 506 | | if constexpr (WithStringArg) { | 507 | | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 508 | 1 | } else { | 509 | 1 | return {std::make_shared<DataTypeInt64>()}; | 510 | 1 | } | 511 | 1 | } |
_ZN5doris16FromUnixTimeImplILb1ELb1EE27get_variadic_argument_typesEv Line | Count | Source | 505 | 1 | static DataTypes get_variadic_argument_types() { | 506 | 1 | if constexpr (WithStringArg) { | 507 | 1 | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 508 | | } else { | 509 | | return {std::make_shared<DataTypeInt64>()}; | 510 | | } | 511 | 1 | } |
|
512 | | static const int64_t TIMESTAMP_VALID_MAX = 32536771199; |
513 | | static constexpr auto name = NewVersion ? "from_unixtime_new" : "from_unixtime"; |
514 | | |
515 | 4 | [[nodiscard]] static bool check_valid(const ArgType& val) { |
516 | 4 | if constexpr (NewVersion) { |
517 | 4 | if (val < 0) [[unlikely]] { |
518 | 0 | return false; |
519 | 0 | } |
520 | 4 | } else { |
521 | 0 | if (val < 0 || val > TIMESTAMP_VALID_MAX) [[unlikely]] { |
522 | 0 | return false; |
523 | 0 | } |
524 | 0 | } |
525 | 4 | return true; |
526 | 4 | } Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE11check_validERKl Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE11check_validERKl _ZN5doris16FromUnixTimeImplILb0ELb1EE11check_validERKl Line | Count | Source | 515 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 516 | 2 | if constexpr (NewVersion) { | 517 | 2 | if (val < 0) [[unlikely]] { | 518 | 0 | return false; | 519 | 0 | } | 520 | | } else { | 521 | | if (val < 0 || val > TIMESTAMP_VALID_MAX) [[unlikely]] { | 522 | | return false; | 523 | | } | 524 | | } | 525 | 2 | return true; | 526 | 2 | } |
_ZN5doris16FromUnixTimeImplILb1ELb1EE11check_validERKl Line | Count | Source | 515 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 516 | 2 | if constexpr (NewVersion) { | 517 | 2 | if (val < 0) [[unlikely]] { | 518 | 0 | return false; | 519 | 0 | } | 520 | | } else { | 521 | | if (val < 0 || val > TIMESTAMP_VALID_MAX) [[unlikely]] { | 522 | | return false; | 523 | | } | 524 | | } | 525 | 2 | return true; | 526 | 2 | } |
|
527 | | |
528 | | static DateV2Value<DateTimeV2ValueType> get_datetime_value(const ArgType& val, |
529 | 3 | const cctz::time_zone& time_zone) { |
530 | 3 | DateV2Value<DateTimeV2ValueType> dt; |
531 | 3 | dt.from_unixtime(val, time_zone); |
532 | 3 | return dt; |
533 | 3 | } Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE18get_datetime_valueERKlRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE18get_datetime_valueERKlRKN4cctz9time_zoneE _ZN5doris16FromUnixTimeImplILb0ELb1EE18get_datetime_valueERKlRKN4cctz9time_zoneE Line | Count | Source | 529 | 2 | const cctz::time_zone& time_zone) { | 530 | 2 | DateV2Value<DateTimeV2ValueType> dt; | 531 | 2 | dt.from_unixtime(val, time_zone); | 532 | 2 | return dt; | 533 | 2 | } |
_ZN5doris16FromUnixTimeImplILb1ELb1EE18get_datetime_valueERKlRKN4cctz9time_zoneE Line | Count | Source | 529 | 1 | const cctz::time_zone& time_zone) { | 530 | 1 | DateV2Value<DateTimeV2ValueType> dt; | 531 | 1 | dt.from_unixtime(val, time_zone); | 532 | 1 | return dt; | 533 | 1 | } |
|
534 | | |
535 | | // return true if null(result is invalid) |
536 | | template <typename Impl> |
537 | | static bool execute(const ArgType& val, StringRef format, ColumnString::Chars& res_data, |
538 | 4 | size_t& offset, const cctz::time_zone& time_zone) { |
539 | 4 | if (!check_valid(val) || has_conflicting_from_unixtime_fraction_specifiers(format)) { |
540 | 1 | return true; |
541 | 1 | } |
542 | 3 | DateV2Value<DateTimeV2ValueType> dt = get_datetime_value(val, time_zone); |
543 | 3 | if (!dt.is_valid_date()) [[unlikely]] { |
544 | 0 | return true; |
545 | 0 | } |
546 | 3 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { |
547 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
548 | 1 | if (!dt.to_format_string_conservative(format.data, format.size, buf, |
549 | 1 | 100 + SAFE_FORMAT_STRING_MARGIN, 0)) { |
550 | 0 | return true; |
551 | 0 | } |
552 | | |
553 | 1 | auto len = strlen(buf); |
554 | 1 | res_data.insert(buf, buf + len); |
555 | 1 | offset += len; |
556 | 2 | } else { |
557 | | // No buffer is needed here because these specially optimized formats have fixed lengths, |
558 | | // and sufficient memory has already been reserved. |
559 | 2 | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); |
560 | 2 | offset += len; |
561 | 2 | } |
562 | 0 | return false; |
563 | 3 | } Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type15UserDefinedImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type10yyyyMMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE7executeINS_16time_format_type8yyyyImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type15UserDefinedImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type10yyyyMMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE7executeINS_16time_format_type8yyyyImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type15UserDefinedImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 538 | 2 | size_t& offset, const cctz::time_zone& time_zone) { | 539 | 2 | if (!check_valid(val) || has_conflicting_from_unixtime_fraction_specifiers(format)) { | 540 | 0 | return true; | 541 | 0 | } | 542 | 2 | DateV2Value<DateTimeV2ValueType> dt = get_datetime_value(val, time_zone); | 543 | 2 | if (!dt.is_valid_date()) [[unlikely]] { | 544 | 0 | return true; | 545 | 0 | } | 546 | | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 547 | | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 548 | | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 549 | | 100 + SAFE_FORMAT_STRING_MARGIN, 0)) { | 550 | | return true; | 551 | | } | 552 | | | 553 | | auto len = strlen(buf); | 554 | | res_data.insert(buf, buf + len); | 555 | | offset += len; | 556 | 2 | } else { | 557 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 558 | | // and sufficient memory has already been reserved. | 559 | 2 | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 560 | 2 | offset += len; | 561 | 2 | } | 562 | 2 | return false; | 563 | 2 | } |
Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type10yyyyMMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb1EE7executeINS_16time_format_type8yyyyImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type15UserDefinedImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 538 | 2 | size_t& offset, const cctz::time_zone& time_zone) { | 539 | 2 | if (!check_valid(val) || has_conflicting_from_unixtime_fraction_specifiers(format)) { | 540 | 1 | return true; | 541 | 1 | } | 542 | 1 | DateV2Value<DateTimeV2ValueType> dt = get_datetime_value(val, time_zone); | 543 | 1 | if (!dt.is_valid_date()) [[unlikely]] { | 544 | 0 | return true; | 545 | 0 | } | 546 | 1 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 547 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 548 | 1 | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 549 | 1 | 100 + SAFE_FORMAT_STRING_MARGIN, 0)) { | 550 | 0 | return true; | 551 | 0 | } | 552 | | | 553 | 1 | auto len = strlen(buf); | 554 | 1 | res_data.insert(buf, buf + len); | 555 | 1 | offset += len; | 556 | | } else { | 557 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 558 | | // and sufficient memory has already been reserved. | 559 | | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 560 | | offset += len; | 561 | | } | 562 | 0 | return false; | 563 | 1 | } |
Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type12yyyyMMddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type14yyyy_MM_ddImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type23yyyy_MM_dd_HH_mm_ssImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type11yyyy_MMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type10yyyyMMImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb1EE7executeINS_16time_format_type8yyyyImplEEEbRKlNS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE |
564 | | }; |
565 | | |
566 | | // only new verison |
567 | | template <bool WithStringArg, bool WithNanosecond = false> |
568 | | struct FromUnixTimeDecimalImpl { |
569 | | static_assert(!WithNanosecond || WithStringArg); |
570 | | using ArgType = std::conditional_t<WithNanosecond, Int128, Int64>; |
571 | | static constexpr PrimitiveType FromPType = WithNanosecond ? TYPE_DECIMAL128I : TYPE_DECIMAL64; |
572 | | constexpr static short Scale = WithNanosecond ? 9 : 6; |
573 | | |
574 | 3 | static DataTypes get_variadic_argument_types() { |
575 | 3 | if constexpr (WithStringArg) { |
576 | 2 | if constexpr (WithNanosecond) { |
577 | 1 | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; |
578 | 1 | } |
579 | 0 | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; |
580 | 2 | } else { |
581 | 1 | return {std::make_shared<DataTypeDecimal64>()}; |
582 | 1 | } |
583 | 3 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 574 | 1 | static DataTypes get_variadic_argument_types() { | 575 | | if constexpr (WithStringArg) { | 576 | | if constexpr (WithNanosecond) { | 577 | | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; | 578 | | } | 579 | | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; | 580 | 1 | } else { | 581 | 1 | return {std::make_shared<DataTypeDecimal64>()}; | 582 | 1 | } | 583 | 1 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 574 | 1 | static DataTypes get_variadic_argument_types() { | 575 | 1 | if constexpr (WithStringArg) { | 576 | | if constexpr (WithNanosecond) { | 577 | | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; | 578 | | } | 579 | 1 | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; | 580 | | } else { | 581 | | return {std::make_shared<DataTypeDecimal64>()}; | 582 | | } | 583 | 1 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE27get_variadic_argument_typesEv Line | Count | Source | 574 | 1 | static DataTypes get_variadic_argument_types() { | 575 | 1 | if constexpr (WithStringArg) { | 576 | 1 | if constexpr (WithNanosecond) { | 577 | 1 | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; | 578 | 1 | } | 579 | 0 | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; | 580 | | } else { | 581 | | return {std::make_shared<DataTypeDecimal64>()}; | 582 | | } | 583 | 1 | } |
|
584 | | static constexpr auto name = "from_unixtime_new"; |
585 | | |
586 | 11 | [[nodiscard]] static bool check_valid(const ArgType& val) { |
587 | 11 | if (val < 0) [[unlikely]] { |
588 | 0 | return false; |
589 | 0 | } |
590 | 11 | return true; |
591 | 11 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE11check_validERKl Line | Count | Source | 586 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 587 | 2 | if (val < 0) [[unlikely]] { | 588 | 0 | return false; | 589 | 0 | } | 590 | 2 | return true; | 591 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE11check_validERKl Line | Count | Source | 586 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 587 | 2 | if (val < 0) [[unlikely]] { | 588 | 0 | return false; | 589 | 0 | } | 590 | 2 | return true; | 591 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE11check_validERKn Line | Count | Source | 586 | 7 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 587 | 7 | if (val < 0) [[unlikely]] { | 588 | 0 | return false; | 589 | 0 | } | 590 | 7 | return true; | 591 | 7 | } |
|
592 | | |
593 | 16 | static int32_t get_nanosecond(const ArgType& fraction) { |
594 | 16 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); |
595 | 16 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE14get_nanosecondERKl Line | Count | Source | 593 | 2 | static int32_t get_nanosecond(const ArgType& fraction) { | 594 | 2 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); | 595 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE14get_nanosecondERKl Line | Count | Source | 593 | 4 | static int32_t get_nanosecond(const ArgType& fraction) { | 594 | 4 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); | 595 | 4 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE14get_nanosecondERKn Line | Count | Source | 593 | 10 | static int32_t get_nanosecond(const ArgType& fraction) { | 594 | 10 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); | 595 | 10 | } |
|
596 | | |
597 | | static DateV2Value<DateTimeV2ValueType> get_datetime_value(const ArgType& interger, |
598 | | const ArgType& fraction, |
599 | | const cctz::time_zone& time_zone, |
600 | 11 | bool preserve_nanosecond) { |
601 | 11 | auto epoch_second = static_cast<int64_t>(interger); |
602 | 11 | int32_t nanosecond = get_nanosecond(fraction); |
603 | 11 | if constexpr (WithNanosecond) { |
604 | 7 | if (!preserve_nanosecond) { |
605 | | // Keep the established %f behavior by rounding the complete instant, including |
606 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. |
607 | 5 | constexpr int32_t MICROS_PER_SECOND = 1000000; |
608 | 5 | const int32_t rounded_microseconds = |
609 | 5 | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / |
610 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; |
611 | 5 | epoch_second += rounded_microseconds / MICROS_PER_SECOND; |
612 | 5 | nanosecond = rounded_microseconds % MICROS_PER_SECOND * |
613 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; |
614 | 5 | } |
615 | 7 | } |
616 | 11 | DateV2Value<DateTimeV2ValueType> dt; |
617 | 11 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); |
618 | 11 | return dt; |
619 | 11 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE18get_datetime_valueERKlS3_RKN4cctz9time_zoneEb Line | Count | Source | 600 | 2 | bool preserve_nanosecond) { | 601 | 2 | auto epoch_second = static_cast<int64_t>(interger); | 602 | 2 | int32_t nanosecond = get_nanosecond(fraction); | 603 | | if constexpr (WithNanosecond) { | 604 | | if (!preserve_nanosecond) { | 605 | | // Keep the established %f behavior by rounding the complete instant, including | 606 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. | 607 | | constexpr int32_t MICROS_PER_SECOND = 1000000; | 608 | | const int32_t rounded_microseconds = | 609 | | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / | 610 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 611 | | epoch_second += rounded_microseconds / MICROS_PER_SECOND; | 612 | | nanosecond = rounded_microseconds % MICROS_PER_SECOND * | 613 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 614 | | } | 615 | | } | 616 | 2 | DateV2Value<DateTimeV2ValueType> dt; | 617 | 2 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); | 618 | 2 | return dt; | 619 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE18get_datetime_valueERKlS3_RKN4cctz9time_zoneEb Line | Count | Source | 600 | 2 | bool preserve_nanosecond) { | 601 | 2 | auto epoch_second = static_cast<int64_t>(interger); | 602 | 2 | int32_t nanosecond = get_nanosecond(fraction); | 603 | | if constexpr (WithNanosecond) { | 604 | | if (!preserve_nanosecond) { | 605 | | // Keep the established %f behavior by rounding the complete instant, including | 606 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. | 607 | | constexpr int32_t MICROS_PER_SECOND = 1000000; | 608 | | const int32_t rounded_microseconds = | 609 | | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / | 610 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 611 | | epoch_second += rounded_microseconds / MICROS_PER_SECOND; | 612 | | nanosecond = rounded_microseconds % MICROS_PER_SECOND * | 613 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 614 | | } | 615 | | } | 616 | 2 | DateV2Value<DateTimeV2ValueType> dt; | 617 | 2 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); | 618 | 2 | return dt; | 619 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE18get_datetime_valueERKnS3_RKN4cctz9time_zoneEb Line | Count | Source | 600 | 7 | bool preserve_nanosecond) { | 601 | 7 | auto epoch_second = static_cast<int64_t>(interger); | 602 | 7 | int32_t nanosecond = get_nanosecond(fraction); | 603 | 7 | if constexpr (WithNanosecond) { | 604 | 7 | if (!preserve_nanosecond) { | 605 | | // Keep the established %f behavior by rounding the complete instant, including | 606 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. | 607 | 5 | constexpr int32_t MICROS_PER_SECOND = 1000000; | 608 | 5 | const int32_t rounded_microseconds = | 609 | 5 | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / | 610 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; | 611 | 5 | epoch_second += rounded_microseconds / MICROS_PER_SECOND; | 612 | 5 | nanosecond = rounded_microseconds % MICROS_PER_SECOND * | 613 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; | 614 | 5 | } | 615 | 7 | } | 616 | 7 | DateV2Value<DateTimeV2ValueType> dt; | 617 | 7 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); | 618 | 7 | return dt; | 619 | 7 | } |
|
620 | | |
621 | | // return true if null(result is invalid) |
622 | | template <typename Impl> |
623 | | static bool execute_decimal(const ArgType& interger, const ArgType& fraction, StringRef format, |
624 | | ColumnString::Chars& res_data, size_t& offset, |
625 | 13 | const cctz::time_zone& time_zone) { |
626 | 13 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { |
627 | 2 | return true; |
628 | 2 | } |
629 | 11 | int64_t fraction_adjustment = 0; |
630 | 11 | if (fraction > 0) { |
631 | 11 | fraction_adjustment = 1; |
632 | 11 | } else if (fraction < 0) { |
633 | 0 | fraction_adjustment = -1; |
634 | 0 | } |
635 | 11 | if (!check_valid(interger + fraction_adjustment)) [[unlikely]] { |
636 | 0 | return true; |
637 | 0 | } |
638 | 11 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); |
639 | 11 | DateV2Value<DateTimeV2ValueType> dt = |
640 | 11 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); |
641 | 11 | if (!dt.is_valid_date()) [[unlikely]] { |
642 | 0 | return true; |
643 | 0 | } |
644 | 11 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { |
645 | 5 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
646 | 5 | if (!dt.to_format_string_conservative(format.data, format.size, buf, |
647 | 5 | 100 + SAFE_FORMAT_STRING_MARGIN, |
648 | 5 | get_nanosecond(fraction))) { |
649 | 0 | return true; |
650 | 0 | } |
651 | | |
652 | 5 | auto len = strlen(buf); |
653 | 5 | res_data.insert(buf, buf + len); |
654 | 5 | offset += len; |
655 | 6 | } else { |
656 | | // No buffer is needed here because these specially optimized formats have fixed lengths, |
657 | | // and sufficient memory has already been reserved. |
658 | 6 | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( |
659 | 6 | dt, (char*)res_data.data() + offset); |
660 | 6 | offset += len; |
661 | 6 | } |
662 | 0 | return false; |
663 | 11 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE15execute_decimalINS_16time_format_type30yyyy_MM_dd_HH_mm_ss_SSSSSSImplEEEbRKlS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 625 | 2 | const cctz::time_zone& time_zone) { | 626 | 2 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 627 | 0 | return true; | 628 | 0 | } | 629 | 2 | int64_t fraction_adjustment = 0; | 630 | 2 | if (fraction > 0) { | 631 | 2 | fraction_adjustment = 1; | 632 | 2 | } else if (fraction < 0) { | 633 | 0 | fraction_adjustment = -1; | 634 | 0 | } | 635 | 2 | if (!check_valid(interger + fraction_adjustment)) [[unlikely]] { | 636 | 0 | return true; | 637 | 0 | } | 638 | 2 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 639 | 2 | DateV2Value<DateTimeV2ValueType> dt = | 640 | 2 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 641 | 2 | if (!dt.is_valid_date()) [[unlikely]] { | 642 | 0 | return true; | 643 | 0 | } | 644 | | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 645 | | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 646 | | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 647 | | 100 + SAFE_FORMAT_STRING_MARGIN, | 648 | | get_nanosecond(fraction))) { | 649 | | return true; | 650 | | } | 651 | | | 652 | | auto len = strlen(buf); | 653 | | res_data.insert(buf, buf + len); | 654 | | offset += len; | 655 | 2 | } else { | 656 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 657 | | // and sufficient memory has already been reserved. | 658 | 2 | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 659 | 2 | dt, (char*)res_data.data() + offset); | 660 | 2 | offset += len; | 661 | 2 | } | 662 | 2 | return false; | 663 | 2 | } |
Unexecuted instantiation: _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE15execute_decimalINS_16time_format_type15UserDefinedImplEEEbRKlS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE15execute_decimalINS_16time_format_type30yyyy_MM_dd_HH_mm_ss_SSSSSSImplEEEbRKlS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE _ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE15execute_decimalINS_16time_format_type15UserDefinedImplEEEbRKlS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 625 | 3 | const cctz::time_zone& time_zone) { | 626 | 3 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 627 | 1 | return true; | 628 | 1 | } | 629 | 2 | int64_t fraction_adjustment = 0; | 630 | 2 | if (fraction > 0) { | 631 | 2 | fraction_adjustment = 1; | 632 | 2 | } else if (fraction < 0) { | 633 | 0 | fraction_adjustment = -1; | 634 | 0 | } | 635 | 2 | if (!check_valid(interger + fraction_adjustment)) [[unlikely]] { | 636 | 0 | return true; | 637 | 0 | } | 638 | 2 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 639 | 2 | DateV2Value<DateTimeV2ValueType> dt = | 640 | 2 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 641 | 2 | if (!dt.is_valid_date()) [[unlikely]] { | 642 | 0 | return true; | 643 | 0 | } | 644 | 2 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 645 | 2 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 646 | 2 | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 647 | 2 | 100 + SAFE_FORMAT_STRING_MARGIN, | 648 | 2 | get_nanosecond(fraction))) { | 649 | 0 | return true; | 650 | 0 | } | 651 | | | 652 | 2 | auto len = strlen(buf); | 653 | 2 | res_data.insert(buf, buf + len); | 654 | 2 | offset += len; | 655 | | } else { | 656 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 657 | | // and sufficient memory has already been reserved. | 658 | | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 659 | | dt, (char*)res_data.data() + offset); | 660 | | offset += len; | 661 | | } | 662 | 0 | return false; | 663 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE15execute_decimalINS_16time_format_type30yyyy_MM_dd_HH_mm_ss_SSSSSSImplEEEbRKnS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 625 | 4 | const cctz::time_zone& time_zone) { | 626 | 4 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 627 | 0 | return true; | 628 | 0 | } | 629 | 4 | int64_t fraction_adjustment = 0; | 630 | 4 | if (fraction > 0) { | 631 | 4 | fraction_adjustment = 1; | 632 | 4 | } else if (fraction < 0) { | 633 | 0 | fraction_adjustment = -1; | 634 | 0 | } | 635 | 4 | if (!check_valid(interger + fraction_adjustment)) [[unlikely]] { | 636 | 0 | return true; | 637 | 0 | } | 638 | 4 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 639 | 4 | DateV2Value<DateTimeV2ValueType> dt = | 640 | 4 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 641 | 4 | if (!dt.is_valid_date()) [[unlikely]] { | 642 | 0 | return true; | 643 | 0 | } | 644 | | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 645 | | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 646 | | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 647 | | 100 + SAFE_FORMAT_STRING_MARGIN, | 648 | | get_nanosecond(fraction))) { | 649 | | return true; | 650 | | } | 651 | | | 652 | | auto len = strlen(buf); | 653 | | res_data.insert(buf, buf + len); | 654 | | offset += len; | 655 | 4 | } else { | 656 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 657 | | // and sufficient memory has already been reserved. | 658 | 4 | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 659 | 4 | dt, (char*)res_data.data() + offset); | 660 | 4 | offset += len; | 661 | 4 | } | 662 | 4 | return false; | 663 | 4 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE15execute_decimalINS_16time_format_type15UserDefinedImplEEEbRKnS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 625 | 4 | const cctz::time_zone& time_zone) { | 626 | 4 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 627 | 1 | return true; | 628 | 1 | } | 629 | 3 | int64_t fraction_adjustment = 0; | 630 | 3 | if (fraction > 0) { | 631 | 3 | fraction_adjustment = 1; | 632 | 3 | } else if (fraction < 0) { | 633 | 0 | fraction_adjustment = -1; | 634 | 0 | } | 635 | 3 | if (!check_valid(interger + fraction_adjustment)) [[unlikely]] { | 636 | 0 | return true; | 637 | 0 | } | 638 | 3 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 639 | 3 | DateV2Value<DateTimeV2ValueType> dt = | 640 | 3 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 641 | 3 | if (!dt.is_valid_date()) [[unlikely]] { | 642 | 0 | return true; | 643 | 0 | } | 644 | 3 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 645 | 3 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 646 | 3 | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 647 | 3 | 100 + SAFE_FORMAT_STRING_MARGIN, | 648 | 3 | get_nanosecond(fraction))) { | 649 | 0 | return true; | 650 | 0 | } | 651 | | | 652 | 3 | auto len = strlen(buf); | 653 | 3 | res_data.insert(buf, buf + len); | 654 | 3 | offset += len; | 655 | | } else { | 656 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 657 | | // and sufficient memory has already been reserved. | 658 | | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 659 | | dt, (char*)res_data.data() + offset); | 660 | | offset += len; | 661 | | } | 662 | 0 | return false; | 663 | 3 | } |
|
664 | | }; |
665 | | |
666 | | // Base template for optimized time field(HOUR, MINUTE, SECOND, MS) extraction from Unix timestamp |
667 | | // Uses lookup_offset to avoid expensive civil_second construction |
668 | | template <typename Impl> |
669 | | class FunctionTimeFieldFromUnixtime : public IFunction { |
670 | | public: |
671 | | static constexpr auto name = Impl::name; |
672 | 8 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); }_ZN5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE6createEv Line | Count | Source | 672 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
_ZN5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE6createEv Line | Count | Source | 672 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
_ZN5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE6createEv Line | Count | Source | 672 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
_ZN5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE6createEv Line | Count | Source | 672 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
|
673 | | |
674 | 4 | String get_name() const override { return name; }_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 674 | 1 | String get_name() const override { return name; } |
_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 674 | 1 | String get_name() const override { return name; } |
_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 674 | 1 | String get_name() const override { return name; } |
_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 674 | 1 | String get_name() const override { return name; } |
|
675 | | |
676 | 0 | size_t get_number_of_arguments() const override { return 1; }Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE23get_number_of_argumentsEv |
677 | | |
678 | 0 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { |
679 | | // microsecond_from_unixtime returns Int32, others (hour/minute/second) return Int8 |
680 | 0 | if constexpr (Impl::ArgType == PrimitiveType::TYPE_DECIMAL64) { |
681 | 0 | return make_nullable(std::make_shared<DataTypeInt32>()); |
682 | 0 | } else { |
683 | 0 | return make_nullable(std::make_shared<DataTypeInt8>()); |
684 | 0 | } |
685 | 0 | } Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE |
686 | | |
687 | | // (UTC 9999-12-31 23:59:59) - 24 * 3600 |
688 | | static const int64_t TIMESTAMP_VALID_MAX = 253402243199L; |
689 | | |
690 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
691 | 0 | uint32_t result, size_t input_rows_count) const override { |
692 | 0 | using ArgColType = typename PrimitiveTypeTraits<Impl::ArgType>::ColumnType; |
693 | 0 | using ResColType = std::conditional_t<Impl::ArgType == PrimitiveType::TYPE_DECIMAL64, |
694 | 0 | ColumnInt32, ColumnInt8>; |
695 | 0 | using ResItemType = typename ResColType::value_type; |
696 | 0 | auto res = ResColType::create(); |
697 | |
|
698 | 0 | const auto* ts_col = |
699 | 0 | assert_cast<const ArgColType*>(block.get_by_position(arguments[0]).column.get()); |
700 | 0 | if constexpr (Impl::ArgType == PrimitiveType::TYPE_DECIMAL64) { |
701 | | // microsecond_from_unixtime only |
702 | 0 | const auto scale = static_cast<int32_t>(ts_col->get_scale()); |
703 | |
|
704 | 0 | for (int i = 0; i < input_rows_count; ++i) { |
705 | 0 | const auto seconds = ts_col->get_intergral_part(i); |
706 | 0 | const auto fraction = ts_col->get_fractional_part(i); |
707 | |
|
708 | 0 | if (seconds < 0 || seconds > TIMESTAMP_VALID_MAX) { |
709 | 0 | return Status::InvalidArgument( |
710 | 0 | "The input value of TimeFiled(from_unixtime()) must between 0 and " |
711 | 0 | "253402243199L"); |
712 | 0 | } |
713 | | |
714 | 0 | ResItemType value = Impl::extract_field(fraction, scale); |
715 | 0 | res->insert_value(value); |
716 | 0 | } |
717 | 0 | } else { |
718 | 0 | auto ctz = context->state()->timezone_obj(); |
719 | 0 | for (int i = 0; i < input_rows_count; ++i) { |
720 | 0 | auto date = ts_col->get_element(i); |
721 | |
|
722 | 0 | if (date < 0 || date > TIMESTAMP_VALID_MAX) { |
723 | 0 | return Status::InvalidArgument( |
724 | 0 | "The input value of TimeFiled(from_unixtime()) must between 0 and " |
725 | 0 | "253402243199L"); |
726 | 0 | } |
727 | | |
728 | 0 | ResItemType value = Impl::extract_field(date, ctz); |
729 | 0 | res->insert_value(value); |
730 | 0 | } |
731 | 0 | } |
732 | 0 | block.replace_by_position(result, std::move(res)); |
733 | 0 | return Status::OK(); |
734 | 0 | } Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm |
735 | | }; |
736 | | |
737 | | struct HourFromUnixtimeImpl { |
738 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_BIGINT; |
739 | | static constexpr auto name = "hour_from_unixtime"; |
740 | | |
741 | 0 | static int8_t extract_field(int64_t local_time, const cctz::time_zone& ctz) { |
742 | 0 | static const auto epoch = std::chrono::time_point_cast<cctz::sys_seconds>( |
743 | 0 | std::chrono::system_clock::from_time_t(0)); |
744 | 0 | cctz::time_point<cctz::sys_seconds> t = epoch + cctz::seconds(local_time); |
745 | 0 | int offset = ctz.lookup_offset(t).offset; |
746 | 0 | local_time += offset; |
747 | |
|
748 | 0 | static const libdivide::divider<int64_t> fast_div_3600(3600); |
749 | 0 | static const libdivide::divider<int64_t> fast_div_86400(86400); |
750 | |
|
751 | 0 | int64_t remainder; |
752 | 0 | if (LIKELY(local_time >= 0)) { |
753 | 0 | remainder = local_time - local_time / fast_div_86400 * 86400; |
754 | 0 | } else { |
755 | 0 | remainder = local_time % 86400; |
756 | 0 | if (remainder < 0) { |
757 | 0 | remainder += 86400; |
758 | 0 | } |
759 | 0 | } |
760 | 0 | return static_cast<int8_t>(remainder / fast_div_3600); |
761 | 0 | } |
762 | | }; |
763 | | |
764 | | struct MinuteFromUnixtimeImpl { |
765 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_BIGINT; |
766 | | static constexpr auto name = "minute_from_unixtime"; |
767 | | |
768 | 0 | static int8_t extract_field(int64_t local_time, const cctz::time_zone& /*ctz*/) { |
769 | 0 | static const libdivide::divider<int64_t> fast_div_60(60); |
770 | 0 | static const libdivide::divider<int64_t> fast_div_3600(3600); |
771 | |
|
772 | 0 | local_time = local_time - local_time / fast_div_3600 * 3600; |
773 | |
|
774 | 0 | return static_cast<int8_t>(local_time / fast_div_60); |
775 | 0 | } |
776 | | }; |
777 | | |
778 | | struct SecondFromUnixtimeImpl { |
779 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_BIGINT; |
780 | | static constexpr auto name = "second_from_unixtime"; |
781 | | |
782 | 0 | static int8_t extract_field(int64_t local_time, const cctz::time_zone& /*ctz*/) { |
783 | 0 | return static_cast<int8_t>(local_time % 60); |
784 | 0 | } |
785 | | }; |
786 | | |
787 | | struct MicrosecondFromUnixtimeImpl { |
788 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_DECIMAL64; |
789 | | static constexpr auto name = "microsecond_from_unixtime"; |
790 | | |
791 | 0 | static int32_t extract_field(int64_t fraction, int scale) { |
792 | 0 | if (scale < 6) { |
793 | 0 | fraction *= common::exp10_i64(6 - scale); |
794 | 0 | } |
795 | 0 | return static_cast<int32_t>(fraction); |
796 | 0 | } |
797 | | }; |
798 | | |
799 | | template <PrimitiveType ArgPType> |
800 | | class FunctionTimeFormat : public IFunction { |
801 | | public: |
802 | | using ArgColType = typename PrimitiveTypeTraits<ArgPType>::ColumnType; |
803 | | using ArgCppType = typename PrimitiveTypeTraits<ArgPType>::CppType; |
804 | | |
805 | | static constexpr auto name = "time_format"; |
806 | 4 | String get_name() const override { return name; }_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE8get_nameB5cxx11Ev Line | Count | Source | 806 | 1 | String get_name() const override { return name; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE8get_nameB5cxx11Ev Line | Count | Source | 806 | 1 | String get_name() const override { return name; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE8get_nameB5cxx11Ev Line | Count | Source | 806 | 1 | String get_name() const override { return name; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE8get_nameB5cxx11Ev Line | Count | Source | 806 | 1 | String get_name() const override { return name; } |
|
807 | 13 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); }_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE6createEv Line | Count | Source | 807 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE6createEv Line | Count | Source | 807 | 3 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE6createEv Line | Count | Source | 807 | 3 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE6createEv Line | Count | Source | 807 | 5 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
|
808 | 4 | DataTypes get_variadic_argument_types_impl() const override { |
809 | 4 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), |
810 | 4 | std::make_shared<DataTypeString>()}; |
811 | 4 | } _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE32get_variadic_argument_types_implEv Line | Count | Source | 808 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 809 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 810 | 1 | std::make_shared<DataTypeString>()}; | 811 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE32get_variadic_argument_types_implEv Line | Count | Source | 808 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 809 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 810 | 1 | std::make_shared<DataTypeString>()}; | 811 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE32get_variadic_argument_types_implEv Line | Count | Source | 808 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 809 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 810 | 1 | std::make_shared<DataTypeString>()}; | 811 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE32get_variadic_argument_types_implEv Line | Count | Source | 808 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 809 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 810 | 1 | std::make_shared<DataTypeString>()}; | 811 | 1 | } |
|
812 | 5 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { |
813 | 5 | return make_nullable(std::make_shared<DataTypeString>()); |
814 | 5 | } Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Line | Count | Source | 812 | 1 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | 813 | 1 | return make_nullable(std::make_shared<DataTypeString>()); | 814 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Line | Count | Source | 812 | 1 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | 813 | 1 | return make_nullable(std::make_shared<DataTypeString>()); | 814 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Line | Count | Source | 812 | 3 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | 813 | 3 | return make_nullable(std::make_shared<DataTypeString>()); | 814 | 3 | } |
|
815 | 5 | size_t get_number_of_arguments() const override { return 2; }Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE23get_number_of_argumentsEv _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE23get_number_of_argumentsEv Line | Count | Source | 815 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE23get_number_of_argumentsEv Line | Count | Source | 815 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE23get_number_of_argumentsEv Line | Count | Source | 815 | 3 | size_t get_number_of_arguments() const override { return 2; } |
|
816 | | |
817 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
818 | 5 | uint32_t result, size_t input_rows_count) const override { |
819 | 5 | auto res_col = ColumnString::create(); |
820 | 5 | ColumnString::Chars& res_chars = res_col->get_chars(); |
821 | 5 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); |
822 | | |
823 | 5 | auto null_map = ColumnUInt8::create(); |
824 | 5 | auto& null_map_data = null_map->get_data(); |
825 | 5 | null_map_data.resize_fill(input_rows_count, 0); |
826 | | |
827 | 5 | res_offsets.reserve(input_rows_count); |
828 | | |
829 | 5 | ColumnPtr arg_col[2]; |
830 | 5 | bool is_const[2]; |
831 | 15 | for (size_t i = 0; i < 2; ++i) { |
832 | 10 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; |
833 | 10 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); |
834 | 10 | } |
835 | | |
836 | 5 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); |
837 | 5 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); |
838 | 10 | for (size_t i = 0; i < input_rows_count; ++i) { |
839 | 5 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); |
840 | 5 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); |
841 | 5 | TimeValue::TimeType time = get_time_value(datetime_val); |
842 | | |
843 | 5 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
844 | 5 | const bool formatted = [&]() { |
845 | 5 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { |
846 | 1 | return TimeValue::to_format_string_conservative( |
847 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, |
848 | 1 | datetime_val.nanosecond()); |
849 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || |
850 | 4 | ArgPType == PrimitiveType::TYPE_TIMEV2) { |
851 | 4 | return TimeValue::to_format_string_conservative( |
852 | 4 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, |
853 | 4 | TimeValue::microsecond(time) * 1000); |
854 | 4 | } else { |
855 | 0 | return TimeValue::to_format_string_conservative( |
856 | 0 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); |
857 | 0 | } |
858 | 5 | }(); Unexecuted instantiation: _ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv _ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv Line | Count | Source | 844 | 1 | const bool formatted = [&]() { | 845 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 846 | | return TimeValue::to_format_string_conservative( | 847 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 848 | | datetime_val.nanosecond()); | 849 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 850 | 1 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 851 | 1 | return TimeValue::to_format_string_conservative( | 852 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 853 | 1 | TimeValue::microsecond(time) * 1000); | 854 | | } else { | 855 | | return TimeValue::to_format_string_conservative( | 856 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 857 | | } | 858 | 1 | }(); |
_ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv Line | Count | Source | 844 | 1 | const bool formatted = [&]() { | 845 | 1 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 846 | 1 | return TimeValue::to_format_string_conservative( | 847 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 848 | 1 | datetime_val.nanosecond()); | 849 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 850 | | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 851 | | return TimeValue::to_format_string_conservative( | 852 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 853 | | TimeValue::microsecond(time) * 1000); | 854 | | } else { | 855 | | return TimeValue::to_format_string_conservative( | 856 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 857 | | } | 858 | 1 | }(); |
_ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv Line | Count | Source | 844 | 3 | const bool formatted = [&]() { | 845 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 846 | | return TimeValue::to_format_string_conservative( | 847 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 848 | | datetime_val.nanosecond()); | 849 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 850 | 3 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 851 | 3 | return TimeValue::to_format_string_conservative( | 852 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 853 | 3 | TimeValue::microsecond(time) * 1000); | 854 | | } else { | 855 | | return TimeValue::to_format_string_conservative( | 856 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 857 | | } | 858 | 3 | }(); |
|
859 | 5 | if (!formatted) { |
860 | 0 | null_map_data[i] = 1; |
861 | 0 | res_offsets.push_back(res_chars.size()); |
862 | 0 | continue; |
863 | 0 | } |
864 | 5 | res_chars.insert(buf, buf + strlen(buf)); |
865 | 5 | res_offsets.push_back(res_chars.size()); |
866 | 5 | } |
867 | 5 | block.replace_by_position(result, |
868 | 5 | ColumnNullable::create(std::move(res_col), std::move(null_map))); |
869 | 5 | return Status::OK(); |
870 | 5 | } Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 818 | 1 | uint32_t result, size_t input_rows_count) const override { | 819 | 1 | auto res_col = ColumnString::create(); | 820 | 1 | ColumnString::Chars& res_chars = res_col->get_chars(); | 821 | 1 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); | 822 | | | 823 | 1 | auto null_map = ColumnUInt8::create(); | 824 | 1 | auto& null_map_data = null_map->get_data(); | 825 | 1 | null_map_data.resize_fill(input_rows_count, 0); | 826 | | | 827 | 1 | res_offsets.reserve(input_rows_count); | 828 | | | 829 | 1 | ColumnPtr arg_col[2]; | 830 | 1 | bool is_const[2]; | 831 | 3 | for (size_t i = 0; i < 2; ++i) { | 832 | 2 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; | 833 | 2 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); | 834 | 2 | } | 835 | | | 836 | 1 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); | 837 | 1 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); | 838 | 2 | for (size_t i = 0; i < input_rows_count; ++i) { | 839 | 1 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); | 840 | 1 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); | 841 | 1 | TimeValue::TimeType time = get_time_value(datetime_val); | 842 | | | 843 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 844 | 1 | const bool formatted = [&]() { | 845 | 1 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 846 | 1 | return TimeValue::to_format_string_conservative( | 847 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 848 | 1 | datetime_val.nanosecond()); | 849 | 1 | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 850 | 1 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 851 | 1 | return TimeValue::to_format_string_conservative( | 852 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 853 | 1 | TimeValue::microsecond(time) * 1000); | 854 | 1 | } else { | 855 | 1 | return TimeValue::to_format_string_conservative( | 856 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 857 | 1 | } | 858 | 1 | }(); | 859 | 1 | if (!formatted) { | 860 | 0 | null_map_data[i] = 1; | 861 | 0 | res_offsets.push_back(res_chars.size()); | 862 | 0 | continue; | 863 | 0 | } | 864 | 1 | res_chars.insert(buf, buf + strlen(buf)); | 865 | 1 | res_offsets.push_back(res_chars.size()); | 866 | 1 | } | 867 | 1 | block.replace_by_position(result, | 868 | 1 | ColumnNullable::create(std::move(res_col), std::move(null_map))); | 869 | 1 | return Status::OK(); | 870 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 818 | 1 | uint32_t result, size_t input_rows_count) const override { | 819 | 1 | auto res_col = ColumnString::create(); | 820 | 1 | ColumnString::Chars& res_chars = res_col->get_chars(); | 821 | 1 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); | 822 | | | 823 | 1 | auto null_map = ColumnUInt8::create(); | 824 | 1 | auto& null_map_data = null_map->get_data(); | 825 | 1 | null_map_data.resize_fill(input_rows_count, 0); | 826 | | | 827 | 1 | res_offsets.reserve(input_rows_count); | 828 | | | 829 | 1 | ColumnPtr arg_col[2]; | 830 | 1 | bool is_const[2]; | 831 | 3 | for (size_t i = 0; i < 2; ++i) { | 832 | 2 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; | 833 | 2 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); | 834 | 2 | } | 835 | | | 836 | 1 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); | 837 | 1 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); | 838 | 2 | for (size_t i = 0; i < input_rows_count; ++i) { | 839 | 1 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); | 840 | 1 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); | 841 | 1 | TimeValue::TimeType time = get_time_value(datetime_val); | 842 | | | 843 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 844 | 1 | const bool formatted = [&]() { | 845 | 1 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 846 | 1 | return TimeValue::to_format_string_conservative( | 847 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 848 | 1 | datetime_val.nanosecond()); | 849 | 1 | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 850 | 1 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 851 | 1 | return TimeValue::to_format_string_conservative( | 852 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 853 | 1 | TimeValue::microsecond(time) * 1000); | 854 | 1 | } else { | 855 | 1 | return TimeValue::to_format_string_conservative( | 856 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 857 | 1 | } | 858 | 1 | }(); | 859 | 1 | if (!formatted) { | 860 | 0 | null_map_data[i] = 1; | 861 | 0 | res_offsets.push_back(res_chars.size()); | 862 | 0 | continue; | 863 | 0 | } | 864 | 1 | res_chars.insert(buf, buf + strlen(buf)); | 865 | 1 | res_offsets.push_back(res_chars.size()); | 866 | 1 | } | 867 | 1 | block.replace_by_position(result, | 868 | 1 | ColumnNullable::create(std::move(res_col), std::move(null_map))); | 869 | 1 | return Status::OK(); | 870 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 818 | 3 | uint32_t result, size_t input_rows_count) const override { | 819 | 3 | auto res_col = ColumnString::create(); | 820 | 3 | ColumnString::Chars& res_chars = res_col->get_chars(); | 821 | 3 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); | 822 | | | 823 | 3 | auto null_map = ColumnUInt8::create(); | 824 | 3 | auto& null_map_data = null_map->get_data(); | 825 | 3 | null_map_data.resize_fill(input_rows_count, 0); | 826 | | | 827 | 3 | res_offsets.reserve(input_rows_count); | 828 | | | 829 | 3 | ColumnPtr arg_col[2]; | 830 | 3 | bool is_const[2]; | 831 | 9 | for (size_t i = 0; i < 2; ++i) { | 832 | 6 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; | 833 | 6 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); | 834 | 6 | } | 835 | | | 836 | 3 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); | 837 | 3 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); | 838 | 6 | for (size_t i = 0; i < input_rows_count; ++i) { | 839 | 3 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); | 840 | 3 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); | 841 | 3 | TimeValue::TimeType time = get_time_value(datetime_val); | 842 | | | 843 | 3 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 844 | 3 | const bool formatted = [&]() { | 845 | 3 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 846 | 3 | return TimeValue::to_format_string_conservative( | 847 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 848 | 3 | datetime_val.nanosecond()); | 849 | 3 | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 850 | 3 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 851 | 3 | return TimeValue::to_format_string_conservative( | 852 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 853 | 3 | TimeValue::microsecond(time) * 1000); | 854 | 3 | } else { | 855 | 3 | return TimeValue::to_format_string_conservative( | 856 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 857 | 3 | } | 858 | 3 | }(); | 859 | 3 | if (!formatted) { | 860 | 0 | null_map_data[i] = 1; | 861 | 0 | res_offsets.push_back(res_chars.size()); | 862 | 0 | continue; | 863 | 0 | } | 864 | 3 | res_chars.insert(buf, buf + strlen(buf)); | 865 | 3 | res_offsets.push_back(res_chars.size()); | 866 | 3 | } | 867 | 3 | block.replace_by_position(result, | 868 | 3 | ColumnNullable::create(std::move(res_col), std::move(null_map))); | 869 | 3 | return Status::OK(); | 870 | 3 | } |
|
871 | | |
872 | | private: |
873 | 5 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { |
874 | 5 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { |
875 | 3 | return static_cast<TimeValue::TimeType>(datetime_val); |
876 | 3 | } else if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { |
877 | 1 | return static_cast<TimeValue::TimeType>(datetime_val.time_part_to_microsecond()); |
878 | 1 | } else { |
879 | 1 | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), |
880 | 1 | datetime_val.second(), datetime_val.microsecond()); |
881 | 1 | } |
882 | 5 | } Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE14get_time_valueERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE14get_time_valueERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 873 | 1 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { | 874 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { | 875 | | return static_cast<TimeValue::TimeType>(datetime_val); | 876 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 877 | | return static_cast<TimeValue::TimeType>(datetime_val.time_part_to_microsecond()); | 878 | 1 | } else { | 879 | 1 | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), | 880 | 1 | datetime_val.second(), datetime_val.microsecond()); | 881 | 1 | } | 882 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE14get_time_valueERKNS_16TimeStampNsValueE Line | Count | Source | 873 | 1 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { | 874 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { | 875 | | return static_cast<TimeValue::TimeType>(datetime_val); | 876 | 1 | } else if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 877 | 1 | return static_cast<TimeValue::TimeType>(datetime_val.time_part_to_microsecond()); | 878 | | } else { | 879 | | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), | 880 | | datetime_val.second(), datetime_val.microsecond()); | 881 | | } | 882 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE14get_time_valueERKd Line | Count | Source | 873 | 3 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { | 874 | 3 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { | 875 | 3 | return static_cast<TimeValue::TimeType>(datetime_val); | 876 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 877 | | return static_cast<TimeValue::TimeType>(datetime_val.time_part_to_microsecond()); | 878 | | } else { | 879 | | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), | 880 | | datetime_val.second(), datetime_val.microsecond()); | 881 | | } | 882 | 3 | } |
|
883 | | }; |
884 | | |
885 | | } // namespace doris |
886 | | |
887 | | #if defined(__GNUC__) && (__GNUC__ >= 15) |
888 | | #pragma GCC diagnostic pop |
889 | | #endif |