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 | | |
106 | | TIME_FUNCTION_IMPL(WeekOfYearImpl, weekofyear, week(mysql_week_mode(3))); |
107 | | TIME_FUNCTION_IMPL(DayOfYearImpl, dayofyear, day_of_year()); |
108 | | TIME_FUNCTION_IMPL(DayOfMonthImpl, dayofmonth, day()); |
109 | | TIME_FUNCTION_IMPL(DayOfWeekImpl, dayofweek, day_of_week()); |
110 | | TIME_FUNCTION_IMPL(WeekDayImpl, weekday, weekday()); |
111 | | // TODO: the method should be always not nullable |
112 | | TIME_FUNCTION_IMPL(ToDaysImpl, to_days, daynr()); |
113 | | TIME_FUNCTION_IMPL(ToSecondsImpl, to_seconds, |
114 | | daynr() * 86400L + date_time_value.time_part_to_seconds()); |
115 | | |
116 | | #define TIME_FUNCTION_ONE_ARG_IMPL(CLASS, UNIT, FUNCTION) \ |
117 | | template <PrimitiveType PType> \ |
118 | | struct CLASS { \ |
119 | | static constexpr PrimitiveType OpArgType = PType; \ |
120 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; \ |
121 | | static constexpr auto name = #UNIT; \ |
122 | | \ |
123 | 12 | static inline auto execute(const ArgType& t) { \ |
124 | 12 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ |
125 | 12 | return date_time_value.FUNCTION; \ |
126 | 12 | } \ _ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 123 | 2 | static inline auto execute(const ArgType& t) { \ | 124 | 2 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 125 | 2 | return date_time_value.FUNCTION; \ | 126 | 2 | } \ |
_ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 123 | 4 | static inline auto execute(const ArgType& t) { \ | 124 | 4 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 125 | 4 | return date_time_value.FUNCTION; \ | 126 | 4 | } \ |
Unexecuted instantiation: _ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE _ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 123 | 2 | static inline auto execute(const ArgType& t) { \ | 124 | 2 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 125 | 2 | return date_time_value.FUNCTION; \ | 126 | 2 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 123 | 4 | static inline auto execute(const ArgType& t) { \ | 124 | 4 | const auto& date_time_value = (typename PrimitiveTypeTraits<PType>::CppType&)(t); \ | 125 | 4 | return date_time_value.FUNCTION; \ | 126 | 4 | } \ |
Unexecuted instantiation: _ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
127 | | \ |
128 | 6 | static DataTypes get_variadic_argument_types() { \ |
129 | 6 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ |
130 | 6 | } \ _ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 128 | 1 | static DataTypes get_variadic_argument_types() { \ | 129 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 130 | 1 | } \ |
_ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 128 | 1 | static DataTypes get_variadic_argument_types() { \ | 129 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 130 | 1 | } \ |
_ZN5doris20ToYearWeekOneArgImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 128 | 1 | static DataTypes get_variadic_argument_types() { \ | 129 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 130 | 1 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 128 | 1 | static DataTypes get_variadic_argument_types() { \ | 129 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 130 | 1 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 128 | 1 | static DataTypes get_variadic_argument_types() { \ | 129 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 130 | 1 | } \ |
_ZN5doris16ToWeekOneArgImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 128 | 1 | static DataTypes get_variadic_argument_types() { \ | 129 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; \ | 130 | 1 | } \ |
|
131 | | } |
132 | | |
133 | | TIME_FUNCTION_ONE_ARG_IMPL(ToWeekOneArgImpl, week, week(mysql_week_mode(0))); |
134 | | TIME_FUNCTION_ONE_ARG_IMPL(ToYearWeekOneArgImpl, yearweek, year_week(mysql_week_mode(0))); |
135 | | |
136 | | template <PrimitiveType PType> |
137 | | struct ToDateImpl { |
138 | | static constexpr PrimitiveType OpArgType = PType; |
139 | | using DateType = typename PrimitiveTypeTraits<PType>::CppType; |
140 | | static constexpr auto name = "to_date"; |
141 | | |
142 | 5 | static auto execute(const DateType& t) { |
143 | 5 | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { |
144 | 2 | return t; |
145 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { |
146 | | t.cast_to_date(); |
147 | | return t; |
148 | 0 | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { |
149 | 0 | DateV2Value<DateV2ValueType> result; |
150 | 0 | const auto civil_value = t.to_datetime(); |
151 | 0 | DataTypeDateTimeV2::cast_to_date_v2(civil_value, result); |
152 | 0 | return result; |
153 | 3 | } else { |
154 | 3 | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( |
155 | 3 | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); |
156 | 3 | } |
157 | 5 | } _ZN5doris10ToDateImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE Line | Count | Source | 142 | 2 | static auto execute(const DateType& t) { | 143 | 2 | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { | 144 | 2 | return t; | 145 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { | 146 | | t.cast_to_date(); | 147 | | return t; | 148 | | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { | 149 | | DateV2Value<DateV2ValueType> result; | 150 | | const auto civil_value = t.to_datetime(); | 151 | | DataTypeDateTimeV2::cast_to_date_v2(civil_value, result); | 152 | | return result; | 153 | | } else { | 154 | | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( | 155 | | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); | 156 | | } | 157 | 2 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 142 | 3 | static auto execute(const DateType& t) { | 143 | | if constexpr (std::is_same_v<DateType, DateV2Value<DateV2ValueType>>) { | 144 | | return t; | 145 | | } else if constexpr (std::is_same_v<DateType, VecDateTimeValue>) { | 146 | | t.cast_to_date(); | 147 | | return t; | 148 | | } else if constexpr (std::is_same_v<DateType, TimeStampNsValue>) { | 149 | | DateV2Value<DateV2ValueType> result; | 150 | | const auto civil_value = t.to_datetime(); | 151 | | DataTypeDateTimeV2::cast_to_date_v2(civil_value, result); | 152 | | return result; | 153 | 3 | } else { | 154 | 3 | return binary_cast<UInt32, DateV2Value<DateV2ValueType>>( | 155 | 3 | (UInt32)(t.to_date_int_val() >> TIME_PART_LENGTH)); | 156 | 3 | } | 157 | 3 | } |
Unexecuted instantiation: _ZN5doris10ToDateImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
158 | | |
159 | 6 | static DataTypes get_variadic_argument_types() { |
160 | 6 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
161 | 6 | } _ZN5doris10ToDateImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 159 | 2 | static DataTypes get_variadic_argument_types() { | 160 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 161 | 2 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 159 | 2 | static DataTypes get_variadic_argument_types() { | 160 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 161 | 2 | } |
_ZN5doris10ToDateImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 159 | 2 | static DataTypes get_variadic_argument_types() { | 160 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 161 | 2 | } |
|
162 | | }; |
163 | | |
164 | | template <PrimitiveType ArgType> |
165 | | struct DateImpl : public ToDateImpl<ArgType> { |
166 | | static constexpr auto name = "date"; |
167 | | }; |
168 | | |
169 | | // TODO: This function look like no need do indeed copy here, we should optimize this function |
170 | | template <PrimitiveType PType> |
171 | | struct TimeStampImpl { |
172 | | static constexpr PrimitiveType OpArgType = PType; |
173 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
174 | | static constexpr auto name = "timestamp"; |
175 | | |
176 | 0 | static auto execute(const ArgType& t) { return t; }Unexecuted instantiation: _ZN5doris13TimeStampImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Unexecuted instantiation: _ZN5doris13TimeStampImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueE |
177 | | |
178 | 2 | static DataTypes get_variadic_argument_types() { |
179 | 2 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
180 | 2 | } _ZN5doris13TimeStampImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 178 | 1 | static DataTypes get_variadic_argument_types() { | 179 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 180 | 1 | } |
_ZN5doris13TimeStampImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 178 | 1 | static DataTypes get_variadic_argument_types() { | 179 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 180 | 1 | } |
|
181 | | }; |
182 | | |
183 | | template <PrimitiveType PType> |
184 | | struct DayNameImpl { |
185 | | static constexpr PrimitiveType OpArgType = PType; |
186 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
187 | | static constexpr auto name = "dayname"; |
188 | | static constexpr auto max_size = MAX_DAY_NAME_LEN; |
189 | | |
190 | | static auto execute(const typename PrimitiveTypeTraits<PType>::CppType& dt, |
191 | | ColumnString::Chars& res_data, size_t& offset, const char* const* day_names, |
192 | 3 | FunctionContext* /*context*/) { |
193 | 3 | DCHECK(day_names != nullptr); |
194 | 3 | const auto* day_name = dt.day_name_with_locale(day_names); |
195 | 3 | if (day_name != nullptr) { |
196 | 3 | auto len = strlen(day_name); |
197 | 3 | memcpy(&res_data[offset], day_name, len); |
198 | 3 | offset += len; |
199 | 3 | } |
200 | 3 | return offset; |
201 | 3 | } _ZN5doris11DayNameImplILNS_13PrimitiveTypeE25EE7executeERKNS_11DateV2ValueINS_15DateV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Line | Count | Source | 192 | 1 | FunctionContext* /*context*/) { | 193 | 1 | DCHECK(day_names != nullptr); | 194 | 1 | const auto* day_name = dt.day_name_with_locale(day_names); | 195 | 1 | if (day_name != nullptr) { | 196 | 1 | auto len = strlen(day_name); | 197 | 1 | memcpy(&res_data[offset], day_name, len); | 198 | 1 | offset += len; | 199 | 1 | } | 200 | 1 | return offset; | 201 | 1 | } |
_ZN5doris11DayNameImplILNS_13PrimitiveTypeE26EE7executeERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE Line | Count | Source | 192 | 2 | FunctionContext* /*context*/) { | 193 | 2 | DCHECK(day_names != nullptr); | 194 | 2 | const auto* day_name = dt.day_name_with_locale(day_names); | 195 | 2 | if (day_name != nullptr) { | 196 | 2 | auto len = strlen(day_name); | 197 | 2 | memcpy(&res_data[offset], day_name, len); | 198 | 2 | offset += len; | 199 | 2 | } | 200 | 2 | return offset; | 201 | 2 | } |
Unexecuted instantiation: _ZN5doris11DayNameImplILNS_13PrimitiveTypeE43EE7executeERKNS_16TimeStampNsValueERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmPKPKcPNS_15FunctionContextE |
202 | | |
203 | 3 | static DataTypes get_variadic_argument_types() { |
204 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
205 | 3 | } _ZN5doris11DayNameImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 203 | 1 | static DataTypes get_variadic_argument_types() { | 204 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 205 | 1 | } |
_ZN5doris11DayNameImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 203 | 1 | static DataTypes get_variadic_argument_types() { | 204 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 205 | 1 | } |
_ZN5doris11DayNameImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 203 | 1 | static DataTypes get_variadic_argument_types() { | 204 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 205 | 1 | } |
|
206 | | }; |
207 | | |
208 | | template <PrimitiveType PType> |
209 | | struct ToIso8601Impl { |
210 | | static constexpr PrimitiveType OpArgType = PType; |
211 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
212 | | static constexpr auto name = "to_iso8601"; |
213 | | static constexpr auto max_size = |
214 | | PType == TYPE_DATEV2 ? 10 : (PType == TYPE_TIMESTAMP_NS ? 29 : 26); |
215 | | |
216 | | static auto execute(const typename PrimitiveTypeTraits<PType>::CppType& dt, |
217 | | ColumnString::Chars& res_data, size_t& offset, |
218 | 0 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { |
219 | 0 | int length = 0; |
220 | 0 | if constexpr (PType == TYPE_TIMESTAMP_NS) { |
221 | 0 | length = dt.to_buffer((char*)res_data.data() + offset); |
222 | 0 | } else { |
223 | 0 | constexpr int scale = PType == TYPE_DATEV2 ? -1 : 6; |
224 | 0 | length = dt.to_buffer((char*)res_data.data() + offset, scale); |
225 | 0 | } |
226 | 0 | if (PType == TYPE_DATETIMEV2 || PType == TYPE_TIMESTAMP_NS || PType == TYPE_TIMESTAMPTZ) { |
227 | 0 | res_data[offset + 10] = 'T'; |
228 | 0 | } |
229 | |
|
230 | 0 | offset += length; |
231 | 0 | return offset; |
232 | 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 |
233 | | |
234 | 3 | static DataTypes get_variadic_argument_types() { |
235 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
236 | 3 | } _ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 234 | 1 | static DataTypes get_variadic_argument_types() { | 235 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 236 | 1 | } |
_ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 234 | 1 | static DataTypes get_variadic_argument_types() { | 235 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 236 | 1 | } |
_ZN5doris13ToIso8601ImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 234 | 1 | static DataTypes get_variadic_argument_types() { | 235 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 236 | 1 | } |
|
237 | | }; |
238 | | |
239 | | // Specialization for TIMESTAMPTZ type |
240 | | template <> |
241 | | struct ToIso8601Impl<TYPE_TIMESTAMPTZ> { |
242 | | static constexpr PrimitiveType OpArgType = TYPE_TIMESTAMPTZ; |
243 | | using ArgType = typename PrimitiveTypeTraits<TYPE_TIMESTAMPTZ>::CppType; |
244 | | static constexpr auto name = "to_iso8601"; |
245 | | // Format: YYYY-MM-DDTHH:MM:SS.SSSSSS+HH:MM |
246 | | static constexpr auto max_size = 32; |
247 | | |
248 | | static auto execute(const TimestampTzValue& tz_value, ColumnString::Chars& res_data, |
249 | | size_t& offset, const char* const* /*names_ptr*/, |
250 | 0 | FunctionContext* context) { |
251 | | // Get timezone |
252 | 0 | const auto& local_time_zone = context->state()->timezone_obj(); |
253 | | |
254 | | // Convert UTC time to local time |
255 | 0 | cctz::civil_second utc_sec(tz_value.year(), tz_value.month(), tz_value.day(), |
256 | 0 | tz_value.hour(), tz_value.minute(), tz_value.second()); |
257 | 0 | cctz::time_point<cctz::seconds> local_time = cctz::convert(utc_sec, cctz::utc_time_zone()); |
258 | |
|
259 | 0 | auto lookup_result = local_time_zone.lookup(local_time); |
260 | 0 | cctz::civil_second civ = lookup_result.cs; |
261 | 0 | auto time_offset = lookup_result.offset; |
262 | |
|
263 | 0 | int offset_hours = time_offset / 3600; |
264 | 0 | int offset_mins = (std::abs(time_offset) % 3600) / 60; |
265 | | |
266 | | // Create local datetime value |
267 | 0 | DateV2Value<DateTimeV2ValueType> local_dt; |
268 | 0 | local_dt.unchecked_set_time((uint16_t)civ.year(), (uint8_t)civ.month(), (uint8_t)civ.day(), |
269 | 0 | (uint8_t)civ.hour(), (uint8_t)civ.minute(), |
270 | 0 | (uint8_t)civ.second(), tz_value.microsecond()); |
271 | | |
272 | | // YYYY-MM-DDTHH:MM:SS.SSSSSS+HH:MM |
273 | 0 | auto length = local_dt.to_buffer((char*)res_data.data() + offset, 6); |
274 | 0 | res_data[offset + 10] = 'T'; |
275 | 0 | res_data[offset + length] = (offset_hours >= 0 ? '+' : '-'); |
276 | 0 | res_data[offset + length + 1] = static_cast<char>('0' + std::abs(offset_hours) / 10); |
277 | 0 | res_data[offset + length + 2] = '0' + std::abs(offset_hours) % 10; |
278 | 0 | res_data[offset + length + 3] = ':'; |
279 | 0 | res_data[offset + length + 4] = static_cast<char>('0' + offset_mins / 10); |
280 | 0 | res_data[offset + length + 5] = '0' + offset_mins % 10; |
281 | |
|
282 | 0 | offset += length + 6; |
283 | 0 | return offset; |
284 | 0 | } |
285 | | |
286 | 1 | static DataTypes get_variadic_argument_types() { |
287 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<TYPE_TIMESTAMPTZ>::DataType>()}; |
288 | 1 | } |
289 | | }; |
290 | | |
291 | | template <PrimitiveType PType> |
292 | | struct MonthNameImpl { |
293 | | static constexpr PrimitiveType OpArgType = PType; |
294 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
295 | | static constexpr auto name = "monthname"; |
296 | | static constexpr auto max_size = MAX_MONTH_NAME_LEN; |
297 | | |
298 | | static auto execute(const typename PrimitiveTypeTraits<PType>::CppType& dt, |
299 | | ColumnString::Chars& res_data, size_t& offset, |
300 | 0 | const char* const* month_names, FunctionContext* /*context*/) { |
301 | 0 | DCHECK(month_names != nullptr); |
302 | 0 | const auto* month_name = dt.month_name_with_locale(month_names); |
303 | 0 | if (month_name != nullptr) { |
304 | 0 | auto len = strlen(month_name); |
305 | 0 | memcpy(&res_data[offset], month_name, len); |
306 | 0 | offset += len; |
307 | 0 | } |
308 | 0 | return offset; |
309 | 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 |
310 | | |
311 | 3 | static DataTypes get_variadic_argument_types() { |
312 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
313 | 3 | } _ZN5doris13MonthNameImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 311 | 1 | static DataTypes get_variadic_argument_types() { | 312 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 313 | 1 | } |
_ZN5doris13MonthNameImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 311 | 1 | static DataTypes get_variadic_argument_types() { | 312 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 313 | 1 | } |
_ZN5doris13MonthNameImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 311 | 1 | static DataTypes get_variadic_argument_types() { | 312 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 313 | 1 | } |
|
314 | | }; |
315 | | |
316 | | template <PrimitiveType PType, typename FormatImpl, const char* FuncName> |
317 | | struct DateTimeV2FormatImpl { |
318 | | static_assert(PType == TYPE_DATETIMEV2 || PType == TYPE_TIMESTAMP_NS); |
319 | | static constexpr PrimitiveType OpArgType = PType; |
320 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
321 | | static constexpr auto name = FuncName; |
322 | | static constexpr auto max_size = FormatImpl::row_size; |
323 | | |
324 | | static auto execute(const ArgType& dt, ColumnString::Chars& res_data, size_t& offset, |
325 | 2 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { |
326 | 2 | auto* buf = reinterpret_cast<char*>(&res_data[offset]); |
327 | 2 | offset += FormatImpl::date_to_str(dt, buf); |
328 | 2 | return offset; |
329 | 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 | 325 | 1 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { | 326 | 1 | auto* buf = reinterpret_cast<char*>(&res_data[offset]); | 327 | 1 | offset += FormatImpl::date_to_str(dt, buf); | 328 | 1 | return offset; | 329 | 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 | 325 | 1 | const char* const* /*names_ptr*/, FunctionContext* /*context*/) { | 326 | 1 | auto* buf = reinterpret_cast<char*>(&res_data[offset]); | 327 | 1 | offset += FormatImpl::date_to_str(dt, buf); | 328 | 1 | return offset; | 329 | 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 |
330 | | |
331 | 22 | static DataTypes get_variadic_argument_types() { |
332 | 22 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; |
333 | 22 | } _ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type11yyyy_MMImplEXadsoKcL_ZNS_14kYearMonthNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9dd_HHImplEXadsoKcL_ZNS_12kDayHourNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type12dd_HH_mmImplEXadsoKcL_ZNS_14kDayMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type15dd_HH_mm_ssImplEXadsoKcL_ZNS_14kDaySecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type22dd_HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_19kDayMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9HH_mmImplEXadsoKcL_ZNS_15kHourMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type12HH_mm_ssImplEXadsoKcL_ZNS_15kHourSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type19HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_20kHourMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type9mm_ssImplEXadsoKcL_ZNS_17kMinuteSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type16mm_ss_SSSSSSImplEXadsoKcL_ZNS_22kMinuteMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE26ENS_16time_format_type13ss_SSSSSSImplEXadsoKcL_ZNS_22kSecondMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type11yyyy_MMImplEXadsoKcL_ZNS_14kYearMonthNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9dd_HHImplEXadsoKcL_ZNS_12kDayHourNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type12dd_HH_mmImplEXadsoKcL_ZNS_14kDayMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type15dd_HH_mm_ssImplEXadsoKcL_ZNS_14kDaySecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type22dd_HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_19kDayMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9HH_mmImplEXadsoKcL_ZNS_15kHourMinuteNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type12HH_mm_ssImplEXadsoKcL_ZNS_15kHourSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type19HH_mm_ss_SSSSSSImplEXadsoKcL_ZNS_20kHourMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type9mm_ssImplEXadsoKcL_ZNS_17kMinuteSecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type16mm_ss_SSSSSSImplEXadsoKcL_ZNS_22kMinuteMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
_ZN5doris20DateTimeV2FormatImplILNS_13PrimitiveTypeE43ENS_16time_format_type13ss_SSSSSSImplEXadsoKcL_ZNS_22kSecondMicrosecondNameEEEEE27get_variadic_argument_typesEv Line | Count | Source | 331 | 1 | static DataTypes get_variadic_argument_types() { | 332 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>()}; | 333 | 1 | } |
|
334 | | }; |
335 | | |
336 | | inline constexpr char kYearMonthName[] = "year_month"; |
337 | | inline constexpr char kDayHourName[] = "day_hour"; |
338 | | inline constexpr char kDayMinuteName[] = "day_minute"; |
339 | | inline constexpr char kDaySecondName[] = "day_second"; |
340 | | inline constexpr char kDayMicrosecondName[] = "day_microsecond"; |
341 | | inline constexpr char kHourMinuteName[] = "hour_minute"; |
342 | | inline constexpr char kHourSecondName[] = "hour_second"; |
343 | | inline constexpr char kHourMicrosecondName[] = "hour_microsecond"; |
344 | | inline constexpr char kMinuteSecondName[] = "minute_second"; |
345 | | inline constexpr char kMinuteMicrosecondName[] = "minute_microsecond"; |
346 | | inline constexpr char kSecondMicrosecondName[] = "second_microsecond"; |
347 | | |
348 | | template <PrimitiveType PType> |
349 | | using YearMonthImpl = DateTimeV2FormatImpl<PType, time_format_type::yyyy_MMImpl, kYearMonthName>; |
350 | | template <PrimitiveType PType> |
351 | | using DayHourImpl = DateTimeV2FormatImpl<PType, time_format_type::dd_HHImpl, kDayHourName>; |
352 | | template <PrimitiveType PType> |
353 | | using DayMinuteImpl = DateTimeV2FormatImpl<PType, time_format_type::dd_HH_mmImpl, kDayMinuteName>; |
354 | | template <PrimitiveType PType> |
355 | | using DaySecondImpl = |
356 | | DateTimeV2FormatImpl<PType, time_format_type::dd_HH_mm_ssImpl, kDaySecondName>; |
357 | | template <PrimitiveType PType> |
358 | | using DayMicrosecondImpl = |
359 | | DateTimeV2FormatImpl<PType, time_format_type::dd_HH_mm_ss_SSSSSSImpl, kDayMicrosecondName>; |
360 | | template <PrimitiveType PType> |
361 | | using HourMinuteImpl = DateTimeV2FormatImpl<PType, time_format_type::HH_mmImpl, kHourMinuteName>; |
362 | | template <PrimitiveType PType> |
363 | | using HourSecondImpl = DateTimeV2FormatImpl<PType, time_format_type::HH_mm_ssImpl, kHourSecondName>; |
364 | | template <PrimitiveType PType> |
365 | | using HourMicrosecondImpl = |
366 | | DateTimeV2FormatImpl<PType, time_format_type::HH_mm_ss_SSSSSSImpl, kHourMicrosecondName>; |
367 | | template <PrimitiveType PType> |
368 | | using MinuteSecondImpl = |
369 | | DateTimeV2FormatImpl<PType, time_format_type::mm_ssImpl, kMinuteSecondName>; |
370 | | template <PrimitiveType PType> |
371 | | using MinuteMicrosecondImpl = |
372 | | DateTimeV2FormatImpl<PType, time_format_type::mm_ss_SSSSSSImpl, kMinuteMicrosecondName>; |
373 | | template <PrimitiveType PType> |
374 | | using SecondMicrosecondImpl = |
375 | | DateTimeV2FormatImpl<PType, time_format_type::ss_SSSSSSImpl, kSecondMicrosecondName>; |
376 | | |
377 | | template <PrimitiveType PType> |
378 | | struct DateFormatImpl { |
379 | | using DateType = typename PrimitiveTypeTraits<PType>::CppType; |
380 | | using ArgType = typename PrimitiveTypeTraits<PType>::CppType; |
381 | | static constexpr PrimitiveType FromPType = PType; |
382 | | |
383 | | static constexpr auto name = "date_format"; |
384 | | |
385 | | template <typename Impl> |
386 | | static bool execute(const DateType& dt, StringRef format, ColumnString::Chars& res_data, |
387 | 26 | size_t& offset, const cctz::time_zone& time_zone) { |
388 | 26 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { |
389 | | // Handle non-special formats. |
390 | 26 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
391 | 26 | const bool formatted = [&]() { |
392 | 26 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { |
393 | 17 | return dt.to_format_string_conservative( |
394 | 17 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, |
395 | 17 | static_cast<int>(dt.microsecond()) * 1000); |
396 | 17 | } else { |
397 | 9 | return dt.to_format_string_conservative(format.data, format.size, buf, |
398 | 9 | 100 + SAFE_FORMAT_STRING_MARGIN); |
399 | 9 | } |
400 | 26 | }(); _ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Line | Count | Source | 391 | 6 | const bool formatted = [&]() { | 392 | | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 393 | | return dt.to_format_string_conservative( | 394 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 395 | | static_cast<int>(dt.microsecond()) * 1000); | 396 | 6 | } else { | 397 | 6 | return dt.to_format_string_conservative(format.data, format.size, buf, | 398 | 6 | 100 + SAFE_FORMAT_STRING_MARGIN); | 399 | 6 | } | 400 | 6 | }(); |
_ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Line | Count | Source | 391 | 17 | const bool formatted = [&]() { | 392 | 17 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 393 | 17 | return dt.to_format_string_conservative( | 394 | 17 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 395 | 17 | static_cast<int>(dt.microsecond()) * 1000); | 396 | | } else { | 397 | | return dt.to_format_string_conservative(format.data, format.size, buf, | 398 | | 100 + SAFE_FORMAT_STRING_MARGIN); | 399 | | } | 400 | 17 | }(); |
_ZZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_16TimeStampNsValueENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneEENKUlvE_clEv Line | Count | Source | 391 | 3 | const bool formatted = [&]() { | 392 | | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 393 | | return dt.to_format_string_conservative( | 394 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 395 | | static_cast<int>(dt.microsecond()) * 1000); | 396 | 3 | } else { | 397 | 3 | return dt.to_format_string_conservative(format.data, format.size, buf, | 398 | 3 | 100 + SAFE_FORMAT_STRING_MARGIN); | 399 | 3 | } | 400 | 3 | }(); |
|
401 | 26 | if (!formatted) { |
402 | 0 | return true; |
403 | 0 | } |
404 | | |
405 | 26 | auto len = strlen(buf); |
406 | 26 | res_data.insert(buf, buf + len); |
407 | 26 | offset += len; |
408 | 26 | return false; |
409 | 26 | } else { |
410 | 0 | if (!dt.is_valid_date()) { |
411 | 0 | return true; |
412 | 0 | } |
413 | | |
414 | | // No buffer is needed here because these specially optimized formats have fixed lengths, |
415 | | // and sufficient memory has already been reserved. |
416 | 0 | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); |
417 | 0 | offset += len; |
418 | |
|
419 | 0 | return false; |
420 | 0 | } |
421 | 26 | } _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE7executeINS_16time_format_type15UserDefinedImplEEEbRKNS_11DateV2ValueINS_15DateV2ValueTypeEEENS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 387 | 6 | size_t& offset, const cctz::time_zone& time_zone) { | 388 | 6 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 389 | | // Handle non-special formats. | 390 | 6 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 391 | 6 | const bool formatted = [&]() { | 392 | 6 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 393 | 6 | return dt.to_format_string_conservative( | 394 | 6 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 395 | 6 | static_cast<int>(dt.microsecond()) * 1000); | 396 | 6 | } else { | 397 | 6 | return dt.to_format_string_conservative(format.data, format.size, buf, | 398 | 6 | 100 + SAFE_FORMAT_STRING_MARGIN); | 399 | 6 | } | 400 | 6 | }(); | 401 | 6 | if (!formatted) { | 402 | 0 | return true; | 403 | 0 | } | 404 | | | 405 | 6 | auto len = strlen(buf); | 406 | 6 | res_data.insert(buf, buf + len); | 407 | 6 | offset += len; | 408 | 6 | return false; | 409 | | } else { | 410 | | if (!dt.is_valid_date()) { | 411 | | return true; | 412 | | } | 413 | | | 414 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 415 | | // and sufficient memory has already been reserved. | 416 | | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 417 | | offset += len; | 418 | | | 419 | | return false; | 420 | | } | 421 | 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 | 387 | 17 | size_t& offset, const cctz::time_zone& time_zone) { | 388 | 17 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 389 | | // Handle non-special formats. | 390 | 17 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 391 | 17 | const bool formatted = [&]() { | 392 | 17 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 393 | 17 | return dt.to_format_string_conservative( | 394 | 17 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 395 | 17 | static_cast<int>(dt.microsecond()) * 1000); | 396 | 17 | } else { | 397 | 17 | return dt.to_format_string_conservative(format.data, format.size, buf, | 398 | 17 | 100 + SAFE_FORMAT_STRING_MARGIN); | 399 | 17 | } | 400 | 17 | }(); | 401 | 17 | if (!formatted) { | 402 | 0 | return true; | 403 | 0 | } | 404 | | | 405 | 17 | auto len = strlen(buf); | 406 | 17 | res_data.insert(buf, buf + len); | 407 | 17 | offset += len; | 408 | 17 | return false; | 409 | | } else { | 410 | | if (!dt.is_valid_date()) { | 411 | | return true; | 412 | | } | 413 | | | 414 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 415 | | // and sufficient memory has already been reserved. | 416 | | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 417 | | offset += len; | 418 | | | 419 | | return false; | 420 | | } | 421 | 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 | 387 | 3 | size_t& offset, const cctz::time_zone& time_zone) { | 388 | 3 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 389 | | // Handle non-special formats. | 390 | 3 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 391 | 3 | const bool formatted = [&]() { | 392 | 3 | if constexpr (PType == PrimitiveType::TYPE_DATETIMEV2) { | 393 | 3 | return dt.to_format_string_conservative( | 394 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, | 395 | 3 | static_cast<int>(dt.microsecond()) * 1000); | 396 | 3 | } else { | 397 | 3 | return dt.to_format_string_conservative(format.data, format.size, buf, | 398 | 3 | 100 + SAFE_FORMAT_STRING_MARGIN); | 399 | 3 | } | 400 | 3 | }(); | 401 | 3 | if (!formatted) { | 402 | 0 | return true; | 403 | 0 | } | 404 | | | 405 | 3 | auto len = strlen(buf); | 406 | 3 | res_data.insert(buf, buf + len); | 407 | 3 | offset += len; | 408 | 3 | return false; | 409 | | } else { | 410 | | if (!dt.is_valid_date()) { | 411 | | return true; | 412 | | } | 413 | | | 414 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 415 | | // and sufficient memory has already been reserved. | 416 | | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 417 | | offset += len; | 418 | | | 419 | | return false; | 420 | | } | 421 | 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 |
422 | | |
423 | 3 | static DataTypes get_variadic_argument_types() { |
424 | 3 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), |
425 | 3 | std::make_shared<DataTypeString>()}; |
426 | 3 | } _ZN5doris14DateFormatImplILNS_13PrimitiveTypeE25EE27get_variadic_argument_typesEv Line | Count | Source | 423 | 1 | static DataTypes get_variadic_argument_types() { | 424 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), | 425 | 1 | std::make_shared<DataTypeString>()}; | 426 | 1 | } |
_ZN5doris14DateFormatImplILNS_13PrimitiveTypeE26EE27get_variadic_argument_typesEv Line | Count | Source | 423 | 1 | static DataTypes get_variadic_argument_types() { | 424 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), | 425 | 1 | std::make_shared<DataTypeString>()}; | 426 | 1 | } |
_ZN5doris14DateFormatImplILNS_13PrimitiveTypeE43EE27get_variadic_argument_typesEv Line | Count | Source | 423 | 1 | static DataTypes get_variadic_argument_types() { | 424 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<PType>::DataType>(), | 425 | 1 | std::make_shared<DataTypeString>()}; | 426 | 1 | } |
|
427 | | }; |
428 | | |
429 | 40 | inline bool contains_from_unixtime_format_specifier(StringRef format, char specifier) { |
430 | 335 | for (size_t i = 0; i + 1 < format.size; ++i) { |
431 | | // Consume the character after every '%', so "%%n" is escaped text rather than %n. |
432 | 312 | if (format.data[i] == '%' && format.data[++i] == specifier) { |
433 | 17 | return true; |
434 | 17 | } |
435 | 312 | } |
436 | 23 | return false; |
437 | 40 | } |
438 | | |
439 | 17 | inline bool has_conflicting_from_unixtime_fraction_specifiers(StringRef format) { |
440 | | // %f formats the microsecond-rounded instant, while %n formats the original nanosecond |
441 | | // instant. For example, 0.999999500 becomes 1.000000 for %f but stays 0.999999500 for %n, |
442 | | // so one result cannot contain both fields consistently. |
443 | 17 | return contains_from_unixtime_format_specifier(format, 'f') && |
444 | 17 | contains_from_unixtime_format_specifier(format, 'n'); |
445 | 17 | } |
446 | | |
447 | | template <bool WithStringArg, bool NewVersion = false> |
448 | | struct FromUnixTimeImpl { |
449 | | using ArgType = Int64; |
450 | | static constexpr PrimitiveType FromPType = TYPE_BIGINT; |
451 | | |
452 | 4 | static DataTypes get_variadic_argument_types() { |
453 | 4 | if constexpr (WithStringArg) { |
454 | 2 | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; |
455 | 2 | } else { |
456 | 2 | return {std::make_shared<DataTypeInt64>()}; |
457 | 2 | } |
458 | 4 | } _ZN5doris16FromUnixTimeImplILb0ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 452 | 1 | static DataTypes get_variadic_argument_types() { | 453 | | if constexpr (WithStringArg) { | 454 | | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 455 | 1 | } else { | 456 | 1 | return {std::make_shared<DataTypeInt64>()}; | 457 | 1 | } | 458 | 1 | } |
_ZN5doris16FromUnixTimeImplILb1ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 452 | 1 | static DataTypes get_variadic_argument_types() { | 453 | 1 | if constexpr (WithStringArg) { | 454 | 1 | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 455 | | } else { | 456 | | return {std::make_shared<DataTypeInt64>()}; | 457 | | } | 458 | 1 | } |
_ZN5doris16FromUnixTimeImplILb0ELb1EE27get_variadic_argument_typesEv Line | Count | Source | 452 | 1 | static DataTypes get_variadic_argument_types() { | 453 | | if constexpr (WithStringArg) { | 454 | | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 455 | 1 | } else { | 456 | 1 | return {std::make_shared<DataTypeInt64>()}; | 457 | 1 | } | 458 | 1 | } |
_ZN5doris16FromUnixTimeImplILb1ELb1EE27get_variadic_argument_typesEv Line | Count | Source | 452 | 1 | static DataTypes get_variadic_argument_types() { | 453 | 1 | if constexpr (WithStringArg) { | 454 | 1 | return {std::make_shared<DataTypeInt64>(), std::make_shared<DataTypeString>()}; | 455 | | } else { | 456 | | return {std::make_shared<DataTypeInt64>()}; | 457 | | } | 458 | 1 | } |
|
459 | | static const int64_t TIMESTAMP_VALID_MAX = 32536771199; |
460 | | static constexpr auto name = NewVersion ? "from_unixtime_new" : "from_unixtime"; |
461 | | |
462 | 4 | [[nodiscard]] static bool check_valid(const ArgType& val) { |
463 | 4 | if constexpr (NewVersion) { |
464 | 4 | if (val < 0) [[unlikely]] { |
465 | 0 | return false; |
466 | 0 | } |
467 | 4 | } else { |
468 | 0 | if (val < 0 || val > TIMESTAMP_VALID_MAX) [[unlikely]] { |
469 | 0 | return false; |
470 | 0 | } |
471 | 0 | } |
472 | 4 | return true; |
473 | 4 | } Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE11check_validERKl Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE11check_validERKl _ZN5doris16FromUnixTimeImplILb0ELb1EE11check_validERKl Line | Count | Source | 462 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 463 | 2 | if constexpr (NewVersion) { | 464 | 2 | if (val < 0) [[unlikely]] { | 465 | 0 | return false; | 466 | 0 | } | 467 | | } else { | 468 | | if (val < 0 || val > TIMESTAMP_VALID_MAX) [[unlikely]] { | 469 | | return false; | 470 | | } | 471 | | } | 472 | 2 | return true; | 473 | 2 | } |
_ZN5doris16FromUnixTimeImplILb1ELb1EE11check_validERKl Line | Count | Source | 462 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 463 | 2 | if constexpr (NewVersion) { | 464 | 2 | if (val < 0) [[unlikely]] { | 465 | 0 | return false; | 466 | 0 | } | 467 | | } else { | 468 | | if (val < 0 || val > TIMESTAMP_VALID_MAX) [[unlikely]] { | 469 | | return false; | 470 | | } | 471 | | } | 472 | 2 | return true; | 473 | 2 | } |
|
474 | | |
475 | | static DateV2Value<DateTimeV2ValueType> get_datetime_value(const ArgType& val, |
476 | 3 | const cctz::time_zone& time_zone) { |
477 | 3 | DateV2Value<DateTimeV2ValueType> dt; |
478 | 3 | dt.from_unixtime(val, time_zone); |
479 | 3 | return dt; |
480 | 3 | } Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb0ELb0EE18get_datetime_valueERKlRKN4cctz9time_zoneE Unexecuted instantiation: _ZN5doris16FromUnixTimeImplILb1ELb0EE18get_datetime_valueERKlRKN4cctz9time_zoneE _ZN5doris16FromUnixTimeImplILb0ELb1EE18get_datetime_valueERKlRKN4cctz9time_zoneE Line | Count | Source | 476 | 2 | const cctz::time_zone& time_zone) { | 477 | 2 | DateV2Value<DateTimeV2ValueType> dt; | 478 | 2 | dt.from_unixtime(val, time_zone); | 479 | 2 | return dt; | 480 | 2 | } |
_ZN5doris16FromUnixTimeImplILb1ELb1EE18get_datetime_valueERKlRKN4cctz9time_zoneE Line | Count | Source | 476 | 1 | const cctz::time_zone& time_zone) { | 477 | 1 | DateV2Value<DateTimeV2ValueType> dt; | 478 | 1 | dt.from_unixtime(val, time_zone); | 479 | 1 | return dt; | 480 | 1 | } |
|
481 | | |
482 | | // return true if null(result is invalid) |
483 | | template <typename Impl> |
484 | | static bool execute(const ArgType& val, StringRef format, ColumnString::Chars& res_data, |
485 | 4 | size_t& offset, const cctz::time_zone& time_zone) { |
486 | 4 | if (!check_valid(val) || has_conflicting_from_unixtime_fraction_specifiers(format)) { |
487 | 1 | return true; |
488 | 1 | } |
489 | 3 | DateV2Value<DateTimeV2ValueType> dt = get_datetime_value(val, time_zone); |
490 | 3 | if (!dt.is_valid_date()) [[unlikely]] { |
491 | 0 | return true; |
492 | 0 | } |
493 | 3 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { |
494 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
495 | 1 | if (!dt.to_format_string_conservative(format.data, format.size, buf, |
496 | 1 | 100 + SAFE_FORMAT_STRING_MARGIN, 0)) { |
497 | 0 | return true; |
498 | 0 | } |
499 | | |
500 | 1 | auto len = strlen(buf); |
501 | 1 | res_data.insert(buf, buf + len); |
502 | 1 | offset += len; |
503 | 2 | } else { |
504 | | // No buffer is needed here because these specially optimized formats have fixed lengths, |
505 | | // and sufficient memory has already been reserved. |
506 | 2 | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); |
507 | 2 | offset += len; |
508 | 2 | } |
509 | 0 | return false; |
510 | 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 | 485 | 2 | size_t& offset, const cctz::time_zone& time_zone) { | 486 | 2 | if (!check_valid(val) || has_conflicting_from_unixtime_fraction_specifiers(format)) { | 487 | 0 | return true; | 488 | 0 | } | 489 | 2 | DateV2Value<DateTimeV2ValueType> dt = get_datetime_value(val, time_zone); | 490 | 2 | if (!dt.is_valid_date()) [[unlikely]] { | 491 | 0 | return true; | 492 | 0 | } | 493 | | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 494 | | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 495 | | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 496 | | 100 + SAFE_FORMAT_STRING_MARGIN, 0)) { | 497 | | return true; | 498 | | } | 499 | | | 500 | | auto len = strlen(buf); | 501 | | res_data.insert(buf, buf + len); | 502 | | offset += len; | 503 | 2 | } else { | 504 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 505 | | // and sufficient memory has already been reserved. | 506 | 2 | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 507 | 2 | offset += len; | 508 | 2 | } | 509 | 2 | return false; | 510 | 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 | 485 | 2 | size_t& offset, const cctz::time_zone& time_zone) { | 486 | 2 | if (!check_valid(val) || has_conflicting_from_unixtime_fraction_specifiers(format)) { | 487 | 1 | return true; | 488 | 1 | } | 489 | 1 | DateV2Value<DateTimeV2ValueType> dt = get_datetime_value(val, time_zone); | 490 | 1 | if (!dt.is_valid_date()) [[unlikely]] { | 491 | 0 | return true; | 492 | 0 | } | 493 | 1 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 494 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 495 | 1 | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 496 | 1 | 100 + SAFE_FORMAT_STRING_MARGIN, 0)) { | 497 | 0 | return true; | 498 | 0 | } | 499 | | | 500 | 1 | auto len = strlen(buf); | 501 | 1 | res_data.insert(buf, buf + len); | 502 | 1 | offset += len; | 503 | | } else { | 504 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 505 | | // and sufficient memory has already been reserved. | 506 | | auto len = Impl::date_to_str(dt, (char*)res_data.data() + offset); | 507 | | offset += len; | 508 | | } | 509 | 0 | return false; | 510 | 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 |
511 | | }; |
512 | | |
513 | | // only new verison |
514 | | template <bool WithStringArg, bool WithNanosecond = false> |
515 | | struct FromUnixTimeDecimalImpl { |
516 | | static_assert(!WithNanosecond || WithStringArg); |
517 | | using ArgType = std::conditional_t<WithNanosecond, Int128, Int64>; |
518 | | static constexpr PrimitiveType FromPType = WithNanosecond ? TYPE_DECIMAL128I : TYPE_DECIMAL64; |
519 | | constexpr static short Scale = WithNanosecond ? 9 : 6; |
520 | | |
521 | 3 | static DataTypes get_variadic_argument_types() { |
522 | 3 | if constexpr (WithStringArg) { |
523 | 2 | if constexpr (WithNanosecond) { |
524 | 1 | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; |
525 | 1 | } |
526 | 0 | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; |
527 | 2 | } else { |
528 | 1 | return {std::make_shared<DataTypeDecimal64>()}; |
529 | 1 | } |
530 | 3 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 521 | 1 | static DataTypes get_variadic_argument_types() { | 522 | | if constexpr (WithStringArg) { | 523 | | if constexpr (WithNanosecond) { | 524 | | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; | 525 | | } | 526 | | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; | 527 | 1 | } else { | 528 | 1 | return {std::make_shared<DataTypeDecimal64>()}; | 529 | 1 | } | 530 | 1 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE27get_variadic_argument_typesEv Line | Count | Source | 521 | 1 | static DataTypes get_variadic_argument_types() { | 522 | 1 | if constexpr (WithStringArg) { | 523 | | if constexpr (WithNanosecond) { | 524 | | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; | 525 | | } | 526 | 1 | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; | 527 | | } else { | 528 | | return {std::make_shared<DataTypeDecimal64>()}; | 529 | | } | 530 | 1 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE27get_variadic_argument_typesEv Line | Count | Source | 521 | 1 | static DataTypes get_variadic_argument_types() { | 522 | 1 | if constexpr (WithStringArg) { | 523 | 1 | if constexpr (WithNanosecond) { | 524 | 1 | return {std::make_shared<DataTypeDecimal128>(), std::make_shared<DataTypeString>()}; | 525 | 1 | } | 526 | 0 | return {std::make_shared<DataTypeDecimal64>(), std::make_shared<DataTypeString>()}; | 527 | | } else { | 528 | | return {std::make_shared<DataTypeDecimal64>()}; | 529 | | } | 530 | 1 | } |
|
531 | | static constexpr auto name = "from_unixtime_new"; |
532 | | |
533 | 11 | [[nodiscard]] static bool check_valid(const ArgType& val) { |
534 | 11 | if (val < 0) [[unlikely]] { |
535 | 0 | return false; |
536 | 0 | } |
537 | 11 | return true; |
538 | 11 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE11check_validERKl Line | Count | Source | 533 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 534 | 2 | if (val < 0) [[unlikely]] { | 535 | 0 | return false; | 536 | 0 | } | 537 | 2 | return true; | 538 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE11check_validERKl Line | Count | Source | 533 | 2 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 534 | 2 | if (val < 0) [[unlikely]] { | 535 | 0 | return false; | 536 | 0 | } | 537 | 2 | return true; | 538 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE11check_validERKn Line | Count | Source | 533 | 7 | [[nodiscard]] static bool check_valid(const ArgType& val) { | 534 | 7 | if (val < 0) [[unlikely]] { | 535 | 0 | return false; | 536 | 0 | } | 537 | 7 | return true; | 538 | 7 | } |
|
539 | | |
540 | 16 | static int32_t get_nanosecond(const ArgType& fraction) { |
541 | 16 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); |
542 | 16 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE14get_nanosecondERKl Line | Count | Source | 540 | 2 | static int32_t get_nanosecond(const ArgType& fraction) { | 541 | 2 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); | 542 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE14get_nanosecondERKl Line | Count | Source | 540 | 4 | static int32_t get_nanosecond(const ArgType& fraction) { | 541 | 4 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); | 542 | 4 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE14get_nanosecondERKn Line | Count | Source | 540 | 10 | static int32_t get_nanosecond(const ArgType& fraction) { | 541 | 10 | return static_cast<int32_t>(fraction) * common::exp10_i32(9 - Scale); | 542 | 10 | } |
|
543 | | |
544 | | static DateV2Value<DateTimeV2ValueType> get_datetime_value(const ArgType& interger, |
545 | | const ArgType& fraction, |
546 | | const cctz::time_zone& time_zone, |
547 | 11 | bool preserve_nanosecond) { |
548 | 11 | auto epoch_second = static_cast<int64_t>(interger); |
549 | 11 | int32_t nanosecond = get_nanosecond(fraction); |
550 | 11 | if constexpr (WithNanosecond) { |
551 | 7 | if (!preserve_nanosecond) { |
552 | | // Keep the established %f behavior by rounding the complete instant, including |
553 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. |
554 | 5 | constexpr int32_t MICROS_PER_SECOND = 1000000; |
555 | 5 | const int32_t rounded_microseconds = |
556 | 5 | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / |
557 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; |
558 | 5 | epoch_second += rounded_microseconds / MICROS_PER_SECOND; |
559 | 5 | nanosecond = rounded_microseconds % MICROS_PER_SECOND * |
560 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; |
561 | 5 | } |
562 | 7 | } |
563 | 11 | DateV2Value<DateTimeV2ValueType> dt; |
564 | 11 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); |
565 | 11 | return dt; |
566 | 11 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE18get_datetime_valueERKlS3_RKN4cctz9time_zoneEb Line | Count | Source | 547 | 2 | bool preserve_nanosecond) { | 548 | 2 | auto epoch_second = static_cast<int64_t>(interger); | 549 | 2 | int32_t nanosecond = get_nanosecond(fraction); | 550 | | if constexpr (WithNanosecond) { | 551 | | if (!preserve_nanosecond) { | 552 | | // Keep the established %f behavior by rounding the complete instant, including | 553 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. | 554 | | constexpr int32_t MICROS_PER_SECOND = 1000000; | 555 | | const int32_t rounded_microseconds = | 556 | | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / | 557 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 558 | | epoch_second += rounded_microseconds / MICROS_PER_SECOND; | 559 | | nanosecond = rounded_microseconds % MICROS_PER_SECOND * | 560 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 561 | | } | 562 | | } | 563 | 2 | DateV2Value<DateTimeV2ValueType> dt; | 564 | 2 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); | 565 | 2 | return dt; | 566 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb0EE18get_datetime_valueERKlS3_RKN4cctz9time_zoneEb Line | Count | Source | 547 | 2 | bool preserve_nanosecond) { | 548 | 2 | auto epoch_second = static_cast<int64_t>(interger); | 549 | 2 | int32_t nanosecond = get_nanosecond(fraction); | 550 | | if constexpr (WithNanosecond) { | 551 | | if (!preserve_nanosecond) { | 552 | | // Keep the established %f behavior by rounding the complete instant, including | 553 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. | 554 | | constexpr int32_t MICROS_PER_SECOND = 1000000; | 555 | | const int32_t rounded_microseconds = | 556 | | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / | 557 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 558 | | epoch_second += rounded_microseconds / MICROS_PER_SECOND; | 559 | | nanosecond = rounded_microseconds % MICROS_PER_SECOND * | 560 | | TimeStampNsValue::NANOS_PER_MICROSECOND; | 561 | | } | 562 | | } | 563 | 2 | DateV2Value<DateTimeV2ValueType> dt; | 564 | 2 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); | 565 | 2 | return dt; | 566 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE18get_datetime_valueERKnS3_RKN4cctz9time_zoneEb Line | Count | Source | 547 | 7 | bool preserve_nanosecond) { | 548 | 7 | auto epoch_second = static_cast<int64_t>(interger); | 549 | 7 | int32_t nanosecond = get_nanosecond(fraction); | 550 | 7 | if constexpr (WithNanosecond) { | 551 | 7 | if (!preserve_nanosecond) { | 552 | | // Keep the established %f behavior by rounding the complete instant, including | 553 | | // carry: 0.999999500 seconds is formatted as 01.000000, not 00.000000. | 554 | 5 | constexpr int32_t MICROS_PER_SECOND = 1000000; | 555 | 5 | const int32_t rounded_microseconds = | 556 | 5 | (nanosecond + TimeStampNsValue::NANOS_PER_MICROSECOND / 2) / | 557 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; | 558 | 5 | epoch_second += rounded_microseconds / MICROS_PER_SECOND; | 559 | 5 | nanosecond = rounded_microseconds % MICROS_PER_SECOND * | 560 | 5 | TimeStampNsValue::NANOS_PER_MICROSECOND; | 561 | 5 | } | 562 | 7 | } | 563 | 7 | DateV2Value<DateTimeV2ValueType> dt; | 564 | 7 | dt.from_unixtime(epoch_second, nanosecond, time_zone, 6); | 565 | 7 | return dt; | 566 | 7 | } |
|
567 | | |
568 | | // return true if null(result is invalid) |
569 | | template <typename Impl> |
570 | | static bool execute_decimal(const ArgType& interger, const ArgType& fraction, StringRef format, |
571 | | ColumnString::Chars& res_data, size_t& offset, |
572 | 13 | const cctz::time_zone& time_zone) { |
573 | 13 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { |
574 | 2 | return true; |
575 | 2 | } |
576 | 11 | if (!check_valid(interger + (fraction > 0 ? 1 : ((fraction < 0) ? -1 : 0)))) [[unlikely]] { |
577 | 0 | return true; |
578 | 0 | } |
579 | 11 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); |
580 | 11 | DateV2Value<DateTimeV2ValueType> dt = |
581 | 11 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); |
582 | 11 | if (!dt.is_valid_date()) [[unlikely]] { |
583 | 0 | return true; |
584 | 0 | } |
585 | 11 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { |
586 | 5 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
587 | 5 | if (!dt.to_format_string_conservative(format.data, format.size, buf, |
588 | 5 | 100 + SAFE_FORMAT_STRING_MARGIN, |
589 | 5 | get_nanosecond(fraction))) { |
590 | 0 | return true; |
591 | 0 | } |
592 | | |
593 | 5 | auto len = strlen(buf); |
594 | 5 | res_data.insert(buf, buf + len); |
595 | 5 | offset += len; |
596 | 6 | } else { |
597 | | // No buffer is needed here because these specially optimized formats have fixed lengths, |
598 | | // and sufficient memory has already been reserved. |
599 | 6 | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( |
600 | 6 | dt, (char*)res_data.data() + offset); |
601 | 6 | offset += len; |
602 | 6 | } |
603 | 0 | return false; |
604 | 11 | } _ZN5doris23FromUnixTimeDecimalImplILb0ELb0EE15execute_decimalINS_16time_format_type30yyyy_MM_dd_HH_mm_ss_SSSSSSImplEEEbRKlS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 572 | 2 | const cctz::time_zone& time_zone) { | 573 | 2 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 574 | 0 | return true; | 575 | 0 | } | 576 | 2 | if (!check_valid(interger + (fraction > 0 ? 1 : ((fraction < 0) ? -1 : 0)))) [[unlikely]] { | 577 | 0 | return true; | 578 | 0 | } | 579 | 2 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 580 | 2 | DateV2Value<DateTimeV2ValueType> dt = | 581 | 2 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 582 | 2 | if (!dt.is_valid_date()) [[unlikely]] { | 583 | 0 | return true; | 584 | 0 | } | 585 | | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 586 | | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 587 | | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 588 | | 100 + SAFE_FORMAT_STRING_MARGIN, | 589 | | get_nanosecond(fraction))) { | 590 | | return true; | 591 | | } | 592 | | | 593 | | auto len = strlen(buf); | 594 | | res_data.insert(buf, buf + len); | 595 | | offset += len; | 596 | 2 | } else { | 597 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 598 | | // and sufficient memory has already been reserved. | 599 | 2 | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 600 | 2 | dt, (char*)res_data.data() + offset); | 601 | 2 | offset += len; | 602 | 2 | } | 603 | 2 | return false; | 604 | 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 | 572 | 3 | const cctz::time_zone& time_zone) { | 573 | 3 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 574 | 1 | return true; | 575 | 1 | } | 576 | 2 | if (!check_valid(interger + (fraction > 0 ? 1 : ((fraction < 0) ? -1 : 0)))) [[unlikely]] { | 577 | 0 | return true; | 578 | 0 | } | 579 | 2 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 580 | 2 | DateV2Value<DateTimeV2ValueType> dt = | 581 | 2 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 582 | 2 | if (!dt.is_valid_date()) [[unlikely]] { | 583 | 0 | return true; | 584 | 0 | } | 585 | 2 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 586 | 2 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 587 | 2 | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 588 | 2 | 100 + SAFE_FORMAT_STRING_MARGIN, | 589 | 2 | get_nanosecond(fraction))) { | 590 | 0 | return true; | 591 | 0 | } | 592 | | | 593 | 2 | auto len = strlen(buf); | 594 | 2 | res_data.insert(buf, buf + len); | 595 | 2 | offset += len; | 596 | | } else { | 597 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 598 | | // and sufficient memory has already been reserved. | 599 | | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 600 | | dt, (char*)res_data.data() + offset); | 601 | | offset += len; | 602 | | } | 603 | 0 | return false; | 604 | 2 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE15execute_decimalINS_16time_format_type30yyyy_MM_dd_HH_mm_ss_SSSSSSImplEEEbRKnS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 572 | 4 | const cctz::time_zone& time_zone) { | 573 | 4 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 574 | 0 | return true; | 575 | 0 | } | 576 | 4 | if (!check_valid(interger + (fraction > 0 ? 1 : ((fraction < 0) ? -1 : 0)))) [[unlikely]] { | 577 | 0 | return true; | 578 | 0 | } | 579 | 4 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 580 | 4 | DateV2Value<DateTimeV2ValueType> dt = | 581 | 4 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 582 | 4 | if (!dt.is_valid_date()) [[unlikely]] { | 583 | 0 | return true; | 584 | 0 | } | 585 | | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 586 | | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 587 | | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 588 | | 100 + SAFE_FORMAT_STRING_MARGIN, | 589 | | get_nanosecond(fraction))) { | 590 | | return true; | 591 | | } | 592 | | | 593 | | auto len = strlen(buf); | 594 | | res_data.insert(buf, buf + len); | 595 | | offset += len; | 596 | 4 | } else { | 597 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 598 | | // and sufficient memory has already been reserved. | 599 | 4 | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 600 | 4 | dt, (char*)res_data.data() + offset); | 601 | 4 | offset += len; | 602 | 4 | } | 603 | 4 | return false; | 604 | 4 | } |
_ZN5doris23FromUnixTimeDecimalImplILb1ELb1EE15execute_decimalINS_16time_format_type15UserDefinedImplEEEbRKnS6_NS_9StringRefERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERmRKN4cctz9time_zoneE Line | Count | Source | 572 | 4 | const cctz::time_zone& time_zone) { | 573 | 4 | if (has_conflicting_from_unixtime_fraction_specifiers(format)) [[unlikely]] { | 574 | 1 | return true; | 575 | 1 | } | 576 | 3 | if (!check_valid(interger + (fraction > 0 ? 1 : ((fraction < 0) ? -1 : 0)))) [[unlikely]] { | 577 | 0 | return true; | 578 | 0 | } | 579 | 3 | const bool preserve_nanosecond = contains_from_unixtime_format_specifier(format, 'n'); | 580 | 3 | DateV2Value<DateTimeV2ValueType> dt = | 581 | 3 | get_datetime_value(interger, fraction, time_zone, preserve_nanosecond); | 582 | 3 | if (!dt.is_valid_date()) [[unlikely]] { | 583 | 0 | return true; | 584 | 0 | } | 585 | 3 | if constexpr (std::is_same_v<Impl, time_format_type::UserDefinedImpl>) { | 586 | 3 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 587 | 3 | if (!dt.to_format_string_conservative(format.data, format.size, buf, | 588 | 3 | 100 + SAFE_FORMAT_STRING_MARGIN, | 589 | 3 | get_nanosecond(fraction))) { | 590 | 0 | return true; | 591 | 0 | } | 592 | | | 593 | 3 | auto len = strlen(buf); | 594 | 3 | res_data.insert(buf, buf + len); | 595 | 3 | offset += len; | 596 | | } else { | 597 | | // No buffer is needed here because these specially optimized formats have fixed lengths, | 598 | | // and sufficient memory has already been reserved. | 599 | | auto len = time_format_type::yyyy_MM_dd_HH_mm_ss_SSSSSSImpl::date_to_str( | 600 | | dt, (char*)res_data.data() + offset); | 601 | | offset += len; | 602 | | } | 603 | 0 | return false; | 604 | 3 | } |
|
605 | | }; |
606 | | |
607 | | // Base template for optimized time field(HOUR, MINUTE, SECOND, MS) extraction from Unix timestamp |
608 | | // Uses lookup_offset to avoid expensive civil_second construction |
609 | | template <typename Impl> |
610 | | class FunctionTimeFieldFromUnixtime : public IFunction { |
611 | | public: |
612 | | static constexpr auto name = Impl::name; |
613 | 8 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); }_ZN5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE6createEv Line | Count | Source | 613 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
_ZN5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE6createEv Line | Count | Source | 613 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
_ZN5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE6createEv Line | Count | Source | 613 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
_ZN5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE6createEv Line | Count | Source | 613 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFieldFromUnixtime<Impl>>(); } |
|
614 | | |
615 | 4 | String get_name() const override { return name; }_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_20HourFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 615 | 1 | String get_name() const override { return name; } |
_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22MinuteFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 615 | 1 | String get_name() const override { return name; } |
_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_22SecondFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 615 | 1 | String get_name() const override { return name; } |
_ZNK5doris29FunctionTimeFieldFromUnixtimeINS_27MicrosecondFromUnixtimeImplEE8get_nameB5cxx11Ev Line | Count | Source | 615 | 1 | String get_name() const override { return name; } |
|
616 | | |
617 | 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 |
618 | | |
619 | 0 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { |
620 | | // microsecond_from_unixtime returns Int32, others (hour/minute/second) return Int8 |
621 | 0 | if constexpr (Impl::ArgType == PrimitiveType::TYPE_DECIMAL64) { |
622 | 0 | return make_nullable(std::make_shared<DataTypeInt32>()); |
623 | 0 | } else { |
624 | 0 | return make_nullable(std::make_shared<DataTypeInt8>()); |
625 | 0 | } |
626 | 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 |
627 | | |
628 | | // (UTC 9999-12-31 23:59:59) - 24 * 3600 |
629 | | static const int64_t TIMESTAMP_VALID_MAX = 253402243199L; |
630 | | |
631 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
632 | 0 | uint32_t result, size_t input_rows_count) const override { |
633 | 0 | using ArgColType = typename PrimitiveTypeTraits<Impl::ArgType>::ColumnType; |
634 | 0 | using ResColType = std::conditional_t<Impl::ArgType == PrimitiveType::TYPE_DECIMAL64, |
635 | 0 | ColumnInt32, ColumnInt8>; |
636 | 0 | using ResItemType = typename ResColType::value_type; |
637 | 0 | auto res = ResColType::create(); |
638 | |
|
639 | 0 | const auto* ts_col = |
640 | 0 | assert_cast<const ArgColType*>(block.get_by_position(arguments[0]).column.get()); |
641 | 0 | if constexpr (Impl::ArgType == PrimitiveType::TYPE_DECIMAL64) { |
642 | | // microsecond_from_unixtime only |
643 | 0 | const auto scale = static_cast<int32_t>(ts_col->get_scale()); |
644 | |
|
645 | 0 | for (int i = 0; i < input_rows_count; ++i) { |
646 | 0 | const auto seconds = ts_col->get_intergral_part(i); |
647 | 0 | const auto fraction = ts_col->get_fractional_part(i); |
648 | |
|
649 | 0 | if (seconds < 0 || seconds > TIMESTAMP_VALID_MAX) { |
650 | 0 | return Status::InvalidArgument( |
651 | 0 | "The input value of TimeFiled(from_unixtime()) must between 0 and " |
652 | 0 | "253402243199L"); |
653 | 0 | } |
654 | | |
655 | 0 | ResItemType value = Impl::extract_field(fraction, scale); |
656 | 0 | res->insert_value(value); |
657 | 0 | } |
658 | 0 | } else { |
659 | 0 | auto ctz = context->state()->timezone_obj(); |
660 | 0 | for (int i = 0; i < input_rows_count; ++i) { |
661 | 0 | auto date = ts_col->get_element(i); |
662 | |
|
663 | 0 | if (date < 0 || date > TIMESTAMP_VALID_MAX) { |
664 | 0 | return Status::InvalidArgument( |
665 | 0 | "The input value of TimeFiled(from_unixtime()) must between 0 and " |
666 | 0 | "253402243199L"); |
667 | 0 | } |
668 | | |
669 | 0 | ResItemType value = Impl::extract_field(date, ctz); |
670 | 0 | res->insert_value(value); |
671 | 0 | } |
672 | 0 | } |
673 | 0 | block.replace_by_position(result, std::move(res)); |
674 | 0 | return Status::OK(); |
675 | 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 |
676 | | }; |
677 | | |
678 | | struct HourFromUnixtimeImpl { |
679 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_BIGINT; |
680 | | static constexpr auto name = "hour_from_unixtime"; |
681 | | |
682 | 0 | static int8_t extract_field(int64_t local_time, const cctz::time_zone& ctz) { |
683 | 0 | static const auto epoch = std::chrono::time_point_cast<cctz::sys_seconds>( |
684 | 0 | std::chrono::system_clock::from_time_t(0)); |
685 | 0 | cctz::time_point<cctz::sys_seconds> t = epoch + cctz::seconds(local_time); |
686 | 0 | int offset = ctz.lookup_offset(t).offset; |
687 | 0 | local_time += offset; |
688 | |
|
689 | 0 | static const libdivide::divider<int64_t> fast_div_3600(3600); |
690 | 0 | static const libdivide::divider<int64_t> fast_div_86400(86400); |
691 | |
|
692 | 0 | int64_t remainder; |
693 | 0 | if (LIKELY(local_time >= 0)) { |
694 | 0 | remainder = local_time - local_time / fast_div_86400 * 86400; |
695 | 0 | } else { |
696 | 0 | remainder = local_time % 86400; |
697 | 0 | if (remainder < 0) { |
698 | 0 | remainder += 86400; |
699 | 0 | } |
700 | 0 | } |
701 | 0 | return static_cast<int8_t>(remainder / fast_div_3600); |
702 | 0 | } |
703 | | }; |
704 | | |
705 | | struct MinuteFromUnixtimeImpl { |
706 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_BIGINT; |
707 | | static constexpr auto name = "minute_from_unixtime"; |
708 | | |
709 | 0 | static int8_t extract_field(int64_t local_time, const cctz::time_zone& /*ctz*/) { |
710 | 0 | static const libdivide::divider<int64_t> fast_div_60(60); |
711 | 0 | static const libdivide::divider<int64_t> fast_div_3600(3600); |
712 | |
|
713 | 0 | local_time = local_time - local_time / fast_div_3600 * 3600; |
714 | |
|
715 | 0 | return static_cast<int8_t>(local_time / fast_div_60); |
716 | 0 | } |
717 | | }; |
718 | | |
719 | | struct SecondFromUnixtimeImpl { |
720 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_BIGINT; |
721 | | static constexpr auto name = "second_from_unixtime"; |
722 | | |
723 | 0 | static int8_t extract_field(int64_t local_time, const cctz::time_zone& /*ctz*/) { |
724 | 0 | return static_cast<int8_t>(local_time % 60); |
725 | 0 | } |
726 | | }; |
727 | | |
728 | | struct MicrosecondFromUnixtimeImpl { |
729 | | static constexpr PrimitiveType ArgType = PrimitiveType::TYPE_DECIMAL64; |
730 | | static constexpr auto name = "microsecond_from_unixtime"; |
731 | | |
732 | 0 | static int32_t extract_field(int64_t fraction, int scale) { |
733 | 0 | if (scale < 6) { |
734 | 0 | fraction *= common::exp10_i64(6 - scale); |
735 | 0 | } |
736 | 0 | return static_cast<int32_t>(fraction); |
737 | 0 | } |
738 | | }; |
739 | | |
740 | | template <PrimitiveType ArgPType> |
741 | | class FunctionTimeFormat : public IFunction { |
742 | | public: |
743 | | using ArgColType = typename PrimitiveTypeTraits<ArgPType>::ColumnType; |
744 | | using ArgCppType = typename PrimitiveTypeTraits<ArgPType>::CppType; |
745 | | |
746 | | static constexpr auto name = "time_format"; |
747 | 4 | String get_name() const override { return name; }_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE8get_nameB5cxx11Ev Line | Count | Source | 747 | 1 | String get_name() const override { return name; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE8get_nameB5cxx11Ev Line | Count | Source | 747 | 1 | String get_name() const override { return name; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE8get_nameB5cxx11Ev Line | Count | Source | 747 | 1 | String get_name() const override { return name; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE8get_nameB5cxx11Ev Line | Count | Source | 747 | 1 | String get_name() const override { return name; } |
|
748 | 13 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); }_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE6createEv Line | Count | Source | 748 | 2 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE6createEv Line | Count | Source | 748 | 3 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE6createEv Line | Count | Source | 748 | 3 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
_ZN5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE6createEv Line | Count | Source | 748 | 5 | static FunctionPtr create() { return std::make_shared<FunctionTimeFormat>(); } |
|
749 | 4 | DataTypes get_variadic_argument_types_impl() const override { |
750 | 4 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), |
751 | 4 | std::make_shared<DataTypeString>()}; |
752 | 4 | } _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE32get_variadic_argument_types_implEv Line | Count | Source | 749 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 750 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 751 | 1 | std::make_shared<DataTypeString>()}; | 752 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE32get_variadic_argument_types_implEv Line | Count | Source | 749 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 750 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 751 | 1 | std::make_shared<DataTypeString>()}; | 752 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE32get_variadic_argument_types_implEv Line | Count | Source | 749 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 750 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 751 | 1 | std::make_shared<DataTypeString>()}; | 752 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE32get_variadic_argument_types_implEv Line | Count | Source | 749 | 1 | DataTypes get_variadic_argument_types_impl() const override { | 750 | 1 | return {std::make_shared<typename PrimitiveTypeTraits<ArgPType>::DataType>(), | 751 | 1 | std::make_shared<DataTypeString>()}; | 752 | 1 | } |
|
753 | 5 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { |
754 | 5 | return make_nullable(std::make_shared<DataTypeString>()); |
755 | 5 | } Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Line | Count | Source | 753 | 1 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | 754 | 1 | return make_nullable(std::make_shared<DataTypeString>()); | 755 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Line | Count | Source | 753 | 1 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | 754 | 1 | return make_nullable(std::make_shared<DataTypeString>()); | 755 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE20get_return_type_implERKSt6vectorINS_21ColumnWithTypeAndNameESaIS4_EE Line | Count | Source | 753 | 3 | DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override { | 754 | 3 | return make_nullable(std::make_shared<DataTypeString>()); | 755 | 3 | } |
|
756 | 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 | 756 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE23get_number_of_argumentsEv Line | Count | Source | 756 | 1 | size_t get_number_of_arguments() const override { return 2; } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE23get_number_of_argumentsEv Line | Count | Source | 756 | 3 | size_t get_number_of_arguments() const override { return 2; } |
|
757 | | |
758 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
759 | 5 | uint32_t result, size_t input_rows_count) const override { |
760 | 5 | auto res_col = ColumnString::create(); |
761 | 5 | ColumnString::Chars& res_chars = res_col->get_chars(); |
762 | 5 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); |
763 | | |
764 | 5 | auto null_map = ColumnUInt8::create(); |
765 | 5 | auto& null_map_data = null_map->get_data(); |
766 | 5 | null_map_data.resize_fill(input_rows_count, 0); |
767 | | |
768 | 5 | res_offsets.reserve(input_rows_count); |
769 | | |
770 | 5 | ColumnPtr arg_col[2]; |
771 | 5 | bool is_const[2]; |
772 | 15 | for (size_t i = 0; i < 2; ++i) { |
773 | 10 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; |
774 | 10 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); |
775 | 10 | } |
776 | | |
777 | 5 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); |
778 | 5 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); |
779 | 10 | for (size_t i = 0; i < input_rows_count; ++i) { |
780 | 5 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); |
781 | 5 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); |
782 | 5 | TimeValue::TimeType time = get_time_value(datetime_val); |
783 | | |
784 | 5 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; |
785 | 5 | const bool formatted = [&]() { |
786 | 5 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { |
787 | 1 | return TimeValue::to_format_string_conservative( |
788 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, |
789 | 1 | datetime_val.nanosecond()); |
790 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || |
791 | 4 | ArgPType == PrimitiveType::TYPE_TIMEV2) { |
792 | 4 | return TimeValue::to_format_string_conservative( |
793 | 4 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, |
794 | 4 | TimeValue::microsecond(time) * 1000); |
795 | 4 | } else { |
796 | 0 | return TimeValue::to_format_string_conservative( |
797 | 0 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); |
798 | 0 | } |
799 | 5 | }(); Unexecuted instantiation: _ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv _ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv Line | Count | Source | 785 | 1 | const bool formatted = [&]() { | 786 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 787 | | return TimeValue::to_format_string_conservative( | 788 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 789 | | datetime_val.nanosecond()); | 790 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 791 | 1 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 792 | 1 | return TimeValue::to_format_string_conservative( | 793 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 794 | 1 | TimeValue::microsecond(time) * 1000); | 795 | | } else { | 796 | | return TimeValue::to_format_string_conservative( | 797 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 798 | | } | 799 | 1 | }(); |
_ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv Line | Count | Source | 785 | 1 | const bool formatted = [&]() { | 786 | 1 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 787 | 1 | return TimeValue::to_format_string_conservative( | 788 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 789 | 1 | datetime_val.nanosecond()); | 790 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 791 | | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 792 | | return TimeValue::to_format_string_conservative( | 793 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 794 | | TimeValue::microsecond(time) * 1000); | 795 | | } else { | 796 | | return TimeValue::to_format_string_conservative( | 797 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 798 | | } | 799 | 1 | }(); |
_ZZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlvE_clEv Line | Count | Source | 785 | 3 | const bool formatted = [&]() { | 786 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 787 | | return TimeValue::to_format_string_conservative( | 788 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 789 | | datetime_val.nanosecond()); | 790 | | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 791 | 3 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 792 | 3 | return TimeValue::to_format_string_conservative( | 793 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 794 | 3 | TimeValue::microsecond(time) * 1000); | 795 | | } else { | 796 | | return TimeValue::to_format_string_conservative( | 797 | | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 798 | | } | 799 | 3 | }(); |
|
800 | 5 | if (!formatted) { |
801 | 0 | null_map_data[i] = 1; |
802 | 0 | res_offsets.push_back(res_chars.size()); |
803 | 0 | continue; |
804 | 0 | } |
805 | 5 | res_chars.insert(buf, buf + strlen(buf)); |
806 | 5 | res_offsets.push_back(res_chars.size()); |
807 | 5 | } |
808 | 5 | block.replace_by_position(result, |
809 | 5 | ColumnNullable::create(std::move(res_col), std::move(null_map))); |
810 | 5 | return Status::OK(); |
811 | 5 | } Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 759 | 1 | uint32_t result, size_t input_rows_count) const override { | 760 | 1 | auto res_col = ColumnString::create(); | 761 | 1 | ColumnString::Chars& res_chars = res_col->get_chars(); | 762 | 1 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); | 763 | | | 764 | 1 | auto null_map = ColumnUInt8::create(); | 765 | 1 | auto& null_map_data = null_map->get_data(); | 766 | 1 | null_map_data.resize_fill(input_rows_count, 0); | 767 | | | 768 | 1 | res_offsets.reserve(input_rows_count); | 769 | | | 770 | 1 | ColumnPtr arg_col[2]; | 771 | 1 | bool is_const[2]; | 772 | 3 | for (size_t i = 0; i < 2; ++i) { | 773 | 2 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; | 774 | 2 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); | 775 | 2 | } | 776 | | | 777 | 1 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); | 778 | 1 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); | 779 | 2 | for (size_t i = 0; i < input_rows_count; ++i) { | 780 | 1 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); | 781 | 1 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); | 782 | 1 | TimeValue::TimeType time = get_time_value(datetime_val); | 783 | | | 784 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 785 | 1 | const bool formatted = [&]() { | 786 | 1 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 787 | 1 | return TimeValue::to_format_string_conservative( | 788 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 789 | 1 | datetime_val.nanosecond()); | 790 | 1 | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 791 | 1 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 792 | 1 | return TimeValue::to_format_string_conservative( | 793 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 794 | 1 | TimeValue::microsecond(time) * 1000); | 795 | 1 | } else { | 796 | 1 | return TimeValue::to_format_string_conservative( | 797 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 798 | 1 | } | 799 | 1 | }(); | 800 | 1 | if (!formatted) { | 801 | 0 | null_map_data[i] = 1; | 802 | 0 | res_offsets.push_back(res_chars.size()); | 803 | 0 | continue; | 804 | 0 | } | 805 | 1 | res_chars.insert(buf, buf + strlen(buf)); | 806 | 1 | res_offsets.push_back(res_chars.size()); | 807 | 1 | } | 808 | 1 | block.replace_by_position(result, | 809 | 1 | ColumnNullable::create(std::move(res_col), std::move(null_map))); | 810 | 1 | return Status::OK(); | 811 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 759 | 1 | uint32_t result, size_t input_rows_count) const override { | 760 | 1 | auto res_col = ColumnString::create(); | 761 | 1 | ColumnString::Chars& res_chars = res_col->get_chars(); | 762 | 1 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); | 763 | | | 764 | 1 | auto null_map = ColumnUInt8::create(); | 765 | 1 | auto& null_map_data = null_map->get_data(); | 766 | 1 | null_map_data.resize_fill(input_rows_count, 0); | 767 | | | 768 | 1 | res_offsets.reserve(input_rows_count); | 769 | | | 770 | 1 | ColumnPtr arg_col[2]; | 771 | 1 | bool is_const[2]; | 772 | 3 | for (size_t i = 0; i < 2; ++i) { | 773 | 2 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; | 774 | 2 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); | 775 | 2 | } | 776 | | | 777 | 1 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); | 778 | 1 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); | 779 | 2 | for (size_t i = 0; i < input_rows_count; ++i) { | 780 | 1 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); | 781 | 1 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); | 782 | 1 | TimeValue::TimeType time = get_time_value(datetime_val); | 783 | | | 784 | 1 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 785 | 1 | const bool formatted = [&]() { | 786 | 1 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 787 | 1 | return TimeValue::to_format_string_conservative( | 788 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 789 | 1 | datetime_val.nanosecond()); | 790 | 1 | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 791 | 1 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 792 | 1 | return TimeValue::to_format_string_conservative( | 793 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 794 | 1 | TimeValue::microsecond(time) * 1000); | 795 | 1 | } else { | 796 | 1 | return TimeValue::to_format_string_conservative( | 797 | 1 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 798 | 1 | } | 799 | 1 | }(); | 800 | 1 | if (!formatted) { | 801 | 0 | null_map_data[i] = 1; | 802 | 0 | res_offsets.push_back(res_chars.size()); | 803 | 0 | continue; | 804 | 0 | } | 805 | 1 | res_chars.insert(buf, buf + strlen(buf)); | 806 | 1 | res_offsets.push_back(res_chars.size()); | 807 | 1 | } | 808 | 1 | block.replace_by_position(result, | 809 | 1 | ColumnNullable::create(std::move(res_col), std::move(null_map))); | 810 | 1 | return Status::OK(); | 811 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 759 | 3 | uint32_t result, size_t input_rows_count) const override { | 760 | 3 | auto res_col = ColumnString::create(); | 761 | 3 | ColumnString::Chars& res_chars = res_col->get_chars(); | 762 | 3 | ColumnString::Offsets& res_offsets = res_col->get_offsets(); | 763 | | | 764 | 3 | auto null_map = ColumnUInt8::create(); | 765 | 3 | auto& null_map_data = null_map->get_data(); | 766 | 3 | null_map_data.resize_fill(input_rows_count, 0); | 767 | | | 768 | 3 | res_offsets.reserve(input_rows_count); | 769 | | | 770 | 3 | ColumnPtr arg_col[2]; | 771 | 3 | bool is_const[2]; | 772 | 9 | for (size_t i = 0; i < 2; ++i) { | 773 | 6 | const ColumnPtr& col = block.get_by_position(arguments[i]).column; | 774 | 6 | std::tie(arg_col[i], is_const[i]) = unpack_if_const(col); | 775 | 6 | } | 776 | | | 777 | 3 | const auto* datetime_col = assert_cast<const ArgColType*>(arg_col[0].get()); | 778 | 3 | const auto* format_col = assert_cast<const ColumnString*>(arg_col[1].get()); | 779 | 6 | for (size_t i = 0; i < input_rows_count; ++i) { | 780 | 3 | const auto& datetime_val = datetime_col->get_element(index_check_const(i, is_const[0])); | 781 | 3 | StringRef format = format_col->get_data_at(index_check_const(i, is_const[1])); | 782 | 3 | TimeValue::TimeType time = get_time_value(datetime_val); | 783 | | | 784 | 3 | char buf[100 + SAFE_FORMAT_STRING_MARGIN]; | 785 | 3 | const bool formatted = [&]() { | 786 | 3 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMESTAMP_NS) { | 787 | 3 | return TimeValue::to_format_string_conservative( | 788 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 789 | 3 | datetime_val.nanosecond()); | 790 | 3 | } else if constexpr (ArgPType == PrimitiveType::TYPE_DATETIMEV2 || | 791 | 3 | ArgPType == PrimitiveType::TYPE_TIMEV2) { | 792 | 3 | return TimeValue::to_format_string_conservative( | 793 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time, | 794 | 3 | TimeValue::microsecond(time) * 1000); | 795 | 3 | } else { | 796 | 3 | return TimeValue::to_format_string_conservative( | 797 | 3 | format.data, format.size, buf, 100 + SAFE_FORMAT_STRING_MARGIN, time); | 798 | 3 | } | 799 | 3 | }(); | 800 | 3 | if (!formatted) { | 801 | 0 | null_map_data[i] = 1; | 802 | 0 | res_offsets.push_back(res_chars.size()); | 803 | 0 | continue; | 804 | 0 | } | 805 | 3 | res_chars.insert(buf, buf + strlen(buf)); | 806 | 3 | res_offsets.push_back(res_chars.size()); | 807 | 3 | } | 808 | 3 | block.replace_by_position(result, | 809 | 3 | ColumnNullable::create(std::move(res_col), std::move(null_map))); | 810 | 3 | return Status::OK(); | 811 | 3 | } |
|
812 | | |
813 | | private: |
814 | 5 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { |
815 | 5 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { |
816 | 3 | return static_cast<TimeValue::TimeType>(datetime_val); |
817 | 3 | } else { |
818 | 2 | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), |
819 | 2 | datetime_val.second(), datetime_val.microsecond()); |
820 | 2 | } |
821 | 5 | } Unexecuted instantiation: _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE25EE14get_time_valueERKNS_11DateV2ValueINS_15DateV2ValueTypeEEE _ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE26EE14get_time_valueERKNS_11DateV2ValueINS_19DateTimeV2ValueTypeEEE Line | Count | Source | 814 | 1 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { | 815 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { | 816 | | return static_cast<TimeValue::TimeType>(datetime_val); | 817 | 1 | } else { | 818 | 1 | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), | 819 | 1 | datetime_val.second(), datetime_val.microsecond()); | 820 | 1 | } | 821 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE43EE14get_time_valueERKNS_16TimeStampNsValueE Line | Count | Source | 814 | 1 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { | 815 | | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { | 816 | | return static_cast<TimeValue::TimeType>(datetime_val); | 817 | 1 | } else { | 818 | 1 | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), | 819 | 1 | datetime_val.second(), datetime_val.microsecond()); | 820 | 1 | } | 821 | 1 | } |
_ZNK5doris18FunctionTimeFormatILNS_13PrimitiveTypeE27EE14get_time_valueERKd Line | Count | Source | 814 | 3 | TimeValue::TimeType get_time_value(const ArgCppType& datetime_val) const { | 815 | 3 | if constexpr (ArgPType == PrimitiveType::TYPE_TIMEV2) { | 816 | 3 | return static_cast<TimeValue::TimeType>(datetime_val); | 817 | | } else { | 818 | | return TimeValue::make_time(datetime_val.hour(), datetime_val.minute(), | 819 | | datetime_val.second(), datetime_val.microsecond()); | 820 | | } | 821 | 3 | } |
|
822 | | }; |
823 | | |
824 | | } // namespace doris |
825 | | |
826 | | #if defined(__GNUC__) && (__GNUC__ >= 15) |
827 | | #pragma GCC diagnostic pop |
828 | | #endif |