be/src/exec/common/field_visitors.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/Common/FieldVisitors.h |
19 | | // and modified by Doris |
20 | | |
21 | | #pragma once |
22 | | |
23 | | #include "common/demangle.h" |
24 | | #include "common/exception.h" |
25 | | #include "common/status.h" |
26 | | #include "core/accurate_comparison.h" |
27 | | #include "core/data_type/primitive_type.h" |
28 | | #include "core/field.h" |
29 | | |
30 | | namespace doris { |
31 | | |
32 | | /** StaticVisitor (and its descendants) - class with overloaded operator() for all types of fields. |
33 | | * You could call visitor for field using function 'apply_visitor'. |
34 | | * Also "binary visitor" is supported - its operator() takes two arguments. |
35 | | */ |
36 | | template <typename R = void> |
37 | | struct StaticVisitor { |
38 | | using ResultType = R; |
39 | | }; |
40 | | |
41 | | /// F is template parameter, to allow universal reference for field, that is useful for const and non-const values. |
42 | | template <typename Visitor, typename F> |
43 | 43.7M | typename std::decay_t<Visitor>::ResultType apply_visitor(Visitor&& visitor, F&& field) { |
44 | 43.7M | switch (field.get_type()) { |
45 | 236k | case PrimitiveType::TYPE_NULL: |
46 | 236k | return visitor.template apply<PrimitiveType::TYPE_NULL>(field.template get<TYPE_NULL>()); |
47 | 0 | case PrimitiveType::TYPE_DATETIMEV2: |
48 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIMEV2>( |
49 | 0 | field.template get<TYPE_DATETIMEV2>()); |
50 | 0 | case PrimitiveType::TYPE_TIMESTAMP_NS: |
51 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMP_NS>( |
52 | 0 | field.template get<TYPE_TIMESTAMP_NS>()); |
53 | 0 | case PrimitiveType::TYPE_TIMESTAMPTZ: |
54 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMPTZ>( |
55 | 0 | field.template get<TYPE_TIMESTAMPTZ>()); |
56 | 81.9k | case PrimitiveType::TYPE_LARGEINT: |
57 | 81.9k | return visitor.template apply<PrimitiveType::TYPE_LARGEINT>( |
58 | 81.9k | field.template get<TYPE_LARGEINT>()); |
59 | 0 | case PrimitiveType::TYPE_DATETIME: |
60 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIME>( |
61 | 0 | field.template get<TYPE_DATETIME>()); |
62 | 0 | case PrimitiveType::TYPE_DATE: |
63 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATE>(field.template get<TYPE_DATE>()); |
64 | 0 | case PrimitiveType::TYPE_DATEV2: |
65 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATEV2>( |
66 | 0 | field.template get<TYPE_DATEV2>()); |
67 | 626k | case PrimitiveType::TYPE_BOOLEAN: |
68 | 626k | return visitor.template apply<PrimitiveType::TYPE_BOOLEAN>( |
69 | 626k | field.template get<TYPE_BOOLEAN>()); |
70 | 12 | case PrimitiveType::TYPE_TINYINT: |
71 | 12 | return visitor.template apply<PrimitiveType::TYPE_TINYINT>( |
72 | 12 | field.template get<TYPE_TINYINT>()); |
73 | 14 | case PrimitiveType::TYPE_SMALLINT: |
74 | 14 | return visitor.template apply<PrimitiveType::TYPE_SMALLINT>( |
75 | 14 | field.template get<TYPE_SMALLINT>()); |
76 | 2.49k | case PrimitiveType::TYPE_INT: |
77 | 2.49k | return visitor.template apply<PrimitiveType::TYPE_INT>(field.template get<TYPE_INT>()); |
78 | 12.7M | case PrimitiveType::TYPE_BIGINT: |
79 | 12.7M | return visitor.template apply<PrimitiveType::TYPE_BIGINT>( |
80 | 12.7M | field.template get<TYPE_BIGINT>()); |
81 | 0 | case PrimitiveType::TYPE_UINT32: |
82 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT32>( |
83 | 0 | field.template get<TYPE_UINT32>()); |
84 | 0 | case PrimitiveType::TYPE_UINT64: |
85 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT64>( |
86 | 0 | field.template get<TYPE_UINT64>()); |
87 | 2 | case PrimitiveType::TYPE_FLOAT: |
88 | 2 | return visitor.template apply<PrimitiveType::TYPE_FLOAT>(field.template get<TYPE_FLOAT>()); |
89 | 0 | case PrimitiveType::TYPE_TIMEV2: |
90 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMEV2>( |
91 | 0 | field.template get<TYPE_TIMEV2>()); |
92 | 5.96M | case PrimitiveType::TYPE_DOUBLE: |
93 | 5.96M | return visitor.template apply<PrimitiveType::TYPE_DOUBLE>( |
94 | 5.96M | field.template get<TYPE_DOUBLE>()); |
95 | 0 | case PrimitiveType::TYPE_IPV4: |
96 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV4>(field.template get<TYPE_IPV4>()); |
97 | 0 | case PrimitiveType::TYPE_IPV6: |
98 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV6>(field.template get<TYPE_IPV6>()); |
99 | 19.6M | case PrimitiveType::TYPE_STRING: |
100 | 19.6M | return visitor.template apply<PrimitiveType::TYPE_STRING>( |
101 | 19.6M | field.template get<TYPE_STRING>()); |
102 | 0 | case PrimitiveType::TYPE_CHAR: |
103 | 0 | return visitor.template apply<PrimitiveType::TYPE_CHAR>(field.template get<TYPE_CHAR>()); |
104 | 0 | case PrimitiveType::TYPE_VARCHAR: |
105 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARCHAR>( |
106 | 0 | field.template get<TYPE_VARCHAR>()); |
107 | 0 | case PrimitiveType::TYPE_VARBINARY: |
108 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARBINARY>( |
109 | 0 | field.template get<TYPE_VARBINARY>()); |
110 | 4.33M | case PrimitiveType::TYPE_ARRAY: |
111 | 4.33M | return visitor.template apply<PrimitiveType::TYPE_ARRAY>(field.template get<TYPE_ARRAY>()); |
112 | 2 | case PrimitiveType::TYPE_STRUCT: |
113 | 2 | return visitor.template apply<PrimitiveType::TYPE_STRUCT>( |
114 | 2 | field.template get<TYPE_STRUCT>()); |
115 | 0 | case PrimitiveType::TYPE_MAP: |
116 | 0 | return visitor.template apply<PrimitiveType::TYPE_MAP>(field.template get<TYPE_MAP>()); |
117 | 2 | case PrimitiveType::TYPE_VARIANT: |
118 | 2 | return visitor.template apply<PrimitiveType::TYPE_VARIANT>( |
119 | 2 | field.template get<TYPE_VARIANT>()); |
120 | 0 | case PrimitiveType::TYPE_DECIMAL32: |
121 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL32>( |
122 | 0 | field.template get<TYPE_DECIMAL32>()); |
123 | 0 | case PrimitiveType::TYPE_DECIMAL64: |
124 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL64>( |
125 | 0 | field.template get<TYPE_DECIMAL64>()); |
126 | 0 | case PrimitiveType::TYPE_DECIMALV2: |
127 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMALV2>( |
128 | 0 | field.template get<TYPE_DECIMALV2>()); |
129 | 0 | case PrimitiveType::TYPE_DECIMAL128I: |
130 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL128I>( |
131 | 0 | field.template get<TYPE_DECIMAL128I>()); |
132 | 0 | case PrimitiveType::TYPE_DECIMAL256: |
133 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL256>( |
134 | 0 | field.template get<TYPE_DECIMAL256>()); |
135 | 0 | case PrimitiveType::TYPE_BITMAP: |
136 | 0 | return visitor.template apply<PrimitiveType::TYPE_BITMAP>( |
137 | 0 | field.template get<TYPE_BITMAP>()); |
138 | 0 | case PrimitiveType::TYPE_HLL: |
139 | 0 | return visitor.template apply<PrimitiveType::TYPE_HLL>(field.template get<TYPE_HLL>()); |
140 | 0 | case PrimitiveType::TYPE_QUANTILE_STATE: |
141 | 0 | return visitor.template apply<PrimitiveType::TYPE_QUANTILE_STATE>( |
142 | 0 | field.template get<TYPE_QUANTILE_STATE>()); |
143 | 93.8k | case PrimitiveType::TYPE_JSONB: |
144 | 93.8k | return visitor.template apply<PrimitiveType::TYPE_JSONB>(field.template get<TYPE_JSONB>()); |
145 | 0 | default: |
146 | 0 | throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Bad type of Field {}", |
147 | 0 | static_cast<int>(field.get_type())); |
148 | 0 | return {}; |
149 | 43.7M | } |
150 | 43.7M | } Unexecuted instantiation: _ZN5doris13apply_visitorIRNS_26FieldVisitorToStringSimpleERKNS_5FieldEEENSt5decayIT_E4type10ResultTypeEOS7_OT0_ _ZN5doris13apply_visitorIRNS_12variant_util24FieldVisitorToScalarTypeERKNS_5FieldEEENSt5decayIT_E4type10ResultTypeEOS8_OT0_ Line | Count | Source | 43 | 4.36M | typename std::decay_t<Visitor>::ResultType apply_visitor(Visitor&& visitor, F&& field) { | 44 | 4.36M | switch (field.get_type()) { | 45 | 11.6k | case PrimitiveType::TYPE_NULL: | 46 | 11.6k | return visitor.template apply<PrimitiveType::TYPE_NULL>(field.template get<TYPE_NULL>()); | 47 | 0 | case PrimitiveType::TYPE_DATETIMEV2: | 48 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIMEV2>( | 49 | 0 | field.template get<TYPE_DATETIMEV2>()); | 50 | 0 | case PrimitiveType::TYPE_TIMESTAMP_NS: | 51 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMP_NS>( | 52 | 0 | field.template get<TYPE_TIMESTAMP_NS>()); | 53 | 0 | case PrimitiveType::TYPE_TIMESTAMPTZ: | 54 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMPTZ>( | 55 | 0 | field.template get<TYPE_TIMESTAMPTZ>()); | 56 | 28.6k | case PrimitiveType::TYPE_LARGEINT: | 57 | 28.6k | return visitor.template apply<PrimitiveType::TYPE_LARGEINT>( | 58 | 28.6k | field.template get<TYPE_LARGEINT>()); | 59 | 0 | case PrimitiveType::TYPE_DATETIME: | 60 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIME>( | 61 | 0 | field.template get<TYPE_DATETIME>()); | 62 | 0 | case PrimitiveType::TYPE_DATE: | 63 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATE>(field.template get<TYPE_DATE>()); | 64 | 0 | case PrimitiveType::TYPE_DATEV2: | 65 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATEV2>( | 66 | 0 | field.template get<TYPE_DATEV2>()); | 67 | 57.2k | case PrimitiveType::TYPE_BOOLEAN: | 68 | 57.2k | return visitor.template apply<PrimitiveType::TYPE_BOOLEAN>( | 69 | 57.2k | field.template get<TYPE_BOOLEAN>()); | 70 | 4 | case PrimitiveType::TYPE_TINYINT: | 71 | 4 | return visitor.template apply<PrimitiveType::TYPE_TINYINT>( | 72 | 4 | field.template get<TYPE_TINYINT>()); | 73 | 0 | case PrimitiveType::TYPE_SMALLINT: | 74 | 0 | return visitor.template apply<PrimitiveType::TYPE_SMALLINT>( | 75 | 0 | field.template get<TYPE_SMALLINT>()); | 76 | 531 | case PrimitiveType::TYPE_INT: | 77 | 531 | return visitor.template apply<PrimitiveType::TYPE_INT>(field.template get<TYPE_INT>()); | 78 | 1.50M | case PrimitiveType::TYPE_BIGINT: | 79 | 1.50M | return visitor.template apply<PrimitiveType::TYPE_BIGINT>( | 80 | 1.50M | field.template get<TYPE_BIGINT>()); | 81 | 0 | case PrimitiveType::TYPE_UINT32: | 82 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT32>( | 83 | 0 | field.template get<TYPE_UINT32>()); | 84 | 0 | case PrimitiveType::TYPE_UINT64: | 85 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT64>( | 86 | 0 | field.template get<TYPE_UINT64>()); | 87 | 0 | case PrimitiveType::TYPE_FLOAT: | 88 | 0 | return visitor.template apply<PrimitiveType::TYPE_FLOAT>(field.template get<TYPE_FLOAT>()); | 89 | 0 | case PrimitiveType::TYPE_TIMEV2: | 90 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMEV2>( | 91 | 0 | field.template get<TYPE_TIMEV2>()); | 92 | 186k | case PrimitiveType::TYPE_DOUBLE: | 93 | 186k | return visitor.template apply<PrimitiveType::TYPE_DOUBLE>( | 94 | 186k | field.template get<TYPE_DOUBLE>()); | 95 | 0 | case PrimitiveType::TYPE_IPV4: | 96 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV4>(field.template get<TYPE_IPV4>()); | 97 | 0 | case PrimitiveType::TYPE_IPV6: | 98 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV6>(field.template get<TYPE_IPV6>()); | 99 | 412k | case PrimitiveType::TYPE_STRING: | 100 | 412k | return visitor.template apply<PrimitiveType::TYPE_STRING>( | 101 | 412k | field.template get<TYPE_STRING>()); | 102 | 0 | case PrimitiveType::TYPE_CHAR: | 103 | 0 | return visitor.template apply<PrimitiveType::TYPE_CHAR>(field.template get<TYPE_CHAR>()); | 104 | 0 | case PrimitiveType::TYPE_VARCHAR: | 105 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARCHAR>( | 106 | 0 | field.template get<TYPE_VARCHAR>()); | 107 | 0 | case PrimitiveType::TYPE_VARBINARY: | 108 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARBINARY>( | 109 | 0 | field.template get<TYPE_VARBINARY>()); | 110 | 2.16M | case PrimitiveType::TYPE_ARRAY: | 111 | 2.16M | return visitor.template apply<PrimitiveType::TYPE_ARRAY>(field.template get<TYPE_ARRAY>()); | 112 | 1 | case PrimitiveType::TYPE_STRUCT: | 113 | 1 | return visitor.template apply<PrimitiveType::TYPE_STRUCT>( | 114 | 1 | field.template get<TYPE_STRUCT>()); | 115 | 0 | case PrimitiveType::TYPE_MAP: | 116 | 0 | return visitor.template apply<PrimitiveType::TYPE_MAP>(field.template get<TYPE_MAP>()); | 117 | 1 | case PrimitiveType::TYPE_VARIANT: | 118 | 1 | return visitor.template apply<PrimitiveType::TYPE_VARIANT>( | 119 | 1 | field.template get<TYPE_VARIANT>()); | 120 | 0 | case PrimitiveType::TYPE_DECIMAL32: | 121 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL32>( | 122 | 0 | field.template get<TYPE_DECIMAL32>()); | 123 | 0 | case PrimitiveType::TYPE_DECIMAL64: | 124 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL64>( | 125 | 0 | field.template get<TYPE_DECIMAL64>()); | 126 | 0 | case PrimitiveType::TYPE_DECIMALV2: | 127 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMALV2>( | 128 | 0 | field.template get<TYPE_DECIMALV2>()); | 129 | 0 | case PrimitiveType::TYPE_DECIMAL128I: | 130 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL128I>( | 131 | 0 | field.template get<TYPE_DECIMAL128I>()); | 132 | 0 | case PrimitiveType::TYPE_DECIMAL256: | 133 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL256>( | 134 | 0 | field.template get<TYPE_DECIMAL256>()); | 135 | 0 | case PrimitiveType::TYPE_BITMAP: | 136 | 0 | return visitor.template apply<PrimitiveType::TYPE_BITMAP>( | 137 | 0 | field.template get<TYPE_BITMAP>()); | 138 | 0 | case PrimitiveType::TYPE_HLL: | 139 | 0 | return visitor.template apply<PrimitiveType::TYPE_HLL>(field.template get<TYPE_HLL>()); | 140 | 0 | case PrimitiveType::TYPE_QUANTILE_STATE: | 141 | 0 | return visitor.template apply<PrimitiveType::TYPE_QUANTILE_STATE>( | 142 | 0 | field.template get<TYPE_QUANTILE_STATE>()); | 143 | 26 | case PrimitiveType::TYPE_JSONB: | 144 | 26 | return visitor.template apply<PrimitiveType::TYPE_JSONB>(field.template get<TYPE_JSONB>()); | 145 | 0 | default: | 146 | 0 | throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Bad type of Field {}", | 147 | 0 | static_cast<int>(field.get_type())); | 148 | 0 | return {}; | 149 | 4.36M | } | 150 | 4.36M | } |
_ZN5doris13apply_visitorINS_12variant_util32FieldVisitorToNumberOfDimensionsERKNS_5FieldEEENSt5decayIT_E4type10ResultTypeEOS7_OT0_ Line | Count | Source | 43 | 18.9M | typename std::decay_t<Visitor>::ResultType apply_visitor(Visitor&& visitor, F&& field) { | 44 | 18.9M | switch (field.get_type()) { | 45 | 106k | case PrimitiveType::TYPE_NULL: | 46 | 106k | return visitor.template apply<PrimitiveType::TYPE_NULL>(field.template get<TYPE_NULL>()); | 47 | 0 | case PrimitiveType::TYPE_DATETIMEV2: | 48 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIMEV2>( | 49 | 0 | field.template get<TYPE_DATETIMEV2>()); | 50 | 0 | case PrimitiveType::TYPE_TIMESTAMP_NS: | 51 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMP_NS>( | 52 | 0 | field.template get<TYPE_TIMESTAMP_NS>()); | 53 | 0 | case PrimitiveType::TYPE_TIMESTAMPTZ: | 54 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMPTZ>( | 55 | 0 | field.template get<TYPE_TIMESTAMPTZ>()); | 56 | 12.3k | case PrimitiveType::TYPE_LARGEINT: | 57 | 12.3k | return visitor.template apply<PrimitiveType::TYPE_LARGEINT>( | 58 | 12.3k | field.template get<TYPE_LARGEINT>()); | 59 | 0 | case PrimitiveType::TYPE_DATETIME: | 60 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIME>( | 61 | 0 | field.template get<TYPE_DATETIME>()); | 62 | 0 | case PrimitiveType::TYPE_DATE: | 63 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATE>(field.template get<TYPE_DATE>()); | 64 | 0 | case PrimitiveType::TYPE_DATEV2: | 65 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATEV2>( | 66 | 0 | field.template get<TYPE_DATEV2>()); | 67 | 255k | case PrimitiveType::TYPE_BOOLEAN: | 68 | 255k | return visitor.template apply<PrimitiveType::TYPE_BOOLEAN>( | 69 | 255k | field.template get<TYPE_BOOLEAN>()); | 70 | 2 | case PrimitiveType::TYPE_TINYINT: | 71 | 2 | return visitor.template apply<PrimitiveType::TYPE_TINYINT>( | 72 | 2 | field.template get<TYPE_TINYINT>()); | 73 | 7 | case PrimitiveType::TYPE_SMALLINT: | 74 | 7 | return visitor.template apply<PrimitiveType::TYPE_SMALLINT>( | 75 | 7 | field.template get<TYPE_SMALLINT>()); | 76 | 718 | case PrimitiveType::TYPE_INT: | 77 | 718 | return visitor.template apply<PrimitiveType::TYPE_INT>(field.template get<TYPE_INT>()); | 78 | 4.86M | case PrimitiveType::TYPE_BIGINT: | 79 | 4.86M | return visitor.template apply<PrimitiveType::TYPE_BIGINT>( | 80 | 4.86M | field.template get<TYPE_BIGINT>()); | 81 | 0 | case PrimitiveType::TYPE_UINT32: | 82 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT32>( | 83 | 0 | field.template get<TYPE_UINT32>()); | 84 | 0 | case PrimitiveType::TYPE_UINT64: | 85 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT64>( | 86 | 0 | field.template get<TYPE_UINT64>()); | 87 | 1 | case PrimitiveType::TYPE_FLOAT: | 88 | 1 | return visitor.template apply<PrimitiveType::TYPE_FLOAT>(field.template get<TYPE_FLOAT>()); | 89 | 0 | case PrimitiveType::TYPE_TIMEV2: | 90 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMEV2>( | 91 | 0 | field.template get<TYPE_TIMEV2>()); | 92 | 2.79M | case PrimitiveType::TYPE_DOUBLE: | 93 | 2.79M | return visitor.template apply<PrimitiveType::TYPE_DOUBLE>( | 94 | 2.79M | field.template get<TYPE_DOUBLE>()); | 95 | 0 | case PrimitiveType::TYPE_IPV4: | 96 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV4>(field.template get<TYPE_IPV4>()); | 97 | 0 | case PrimitiveType::TYPE_IPV6: | 98 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV6>(field.template get<TYPE_IPV6>()); | 99 | 9.41M | case PrimitiveType::TYPE_STRING: | 100 | 9.41M | return visitor.template apply<PrimitiveType::TYPE_STRING>( | 101 | 9.41M | field.template get<TYPE_STRING>()); | 102 | 0 | case PrimitiveType::TYPE_CHAR: | 103 | 0 | return visitor.template apply<PrimitiveType::TYPE_CHAR>(field.template get<TYPE_CHAR>()); | 104 | 0 | case PrimitiveType::TYPE_VARCHAR: | 105 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARCHAR>( | 106 | 0 | field.template get<TYPE_VARCHAR>()); | 107 | 0 | case PrimitiveType::TYPE_VARBINARY: | 108 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARBINARY>( | 109 | 0 | field.template get<TYPE_VARBINARY>()); | 110 | 1.48M | case PrimitiveType::TYPE_ARRAY: | 111 | 1.48M | return visitor.template apply<PrimitiveType::TYPE_ARRAY>(field.template get<TYPE_ARRAY>()); | 112 | 1 | case PrimitiveType::TYPE_STRUCT: | 113 | 1 | return visitor.template apply<PrimitiveType::TYPE_STRUCT>( | 114 | 1 | field.template get<TYPE_STRUCT>()); | 115 | 0 | case PrimitiveType::TYPE_MAP: | 116 | 0 | return visitor.template apply<PrimitiveType::TYPE_MAP>(field.template get<TYPE_MAP>()); | 117 | 1 | case PrimitiveType::TYPE_VARIANT: | 118 | 1 | return visitor.template apply<PrimitiveType::TYPE_VARIANT>( | 119 | 1 | field.template get<TYPE_VARIANT>()); | 120 | 0 | case PrimitiveType::TYPE_DECIMAL32: | 121 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL32>( | 122 | 0 | field.template get<TYPE_DECIMAL32>()); | 123 | 0 | case PrimitiveType::TYPE_DECIMAL64: | 124 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL64>( | 125 | 0 | field.template get<TYPE_DECIMAL64>()); | 126 | 0 | case PrimitiveType::TYPE_DECIMALV2: | 127 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMALV2>( | 128 | 0 | field.template get<TYPE_DECIMALV2>()); | 129 | 0 | case PrimitiveType::TYPE_DECIMAL128I: | 130 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL128I>( | 131 | 0 | field.template get<TYPE_DECIMAL128I>()); | 132 | 0 | case PrimitiveType::TYPE_DECIMAL256: | 133 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL256>( | 134 | 0 | field.template get<TYPE_DECIMAL256>()); | 135 | 0 | case PrimitiveType::TYPE_BITMAP: | 136 | 0 | return visitor.template apply<PrimitiveType::TYPE_BITMAP>( | 137 | 0 | field.template get<TYPE_BITMAP>()); | 138 | 0 | case PrimitiveType::TYPE_HLL: | 139 | 0 | return visitor.template apply<PrimitiveType::TYPE_HLL>(field.template get<TYPE_HLL>()); | 140 | 0 | case PrimitiveType::TYPE_QUANTILE_STATE: | 141 | 0 | return visitor.template apply<PrimitiveType::TYPE_QUANTILE_STATE>( | 142 | 0 | field.template get<TYPE_QUANTILE_STATE>()); | 143 | 46.8k | case PrimitiveType::TYPE_JSONB: | 144 | 46.8k | return visitor.template apply<PrimitiveType::TYPE_JSONB>(field.template get<TYPE_JSONB>()); | 145 | 0 | default: | 146 | 0 | throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Bad type of Field {}", | 147 | 0 | static_cast<int>(field.get_type())); | 148 | 0 | return {}; | 149 | 18.9M | } | 150 | 18.9M | } |
_ZN5doris13apply_visitorIRNS_12variant_util32FieldVisitorToNumberOfDimensionsERKNS_5FieldEEENSt5decayIT_E4type10ResultTypeEOS8_OT0_ Line | Count | Source | 43 | 2.87M | typename std::decay_t<Visitor>::ResultType apply_visitor(Visitor&& visitor, F&& field) { | 44 | 2.87M | switch (field.get_type()) { | 45 | 11.6k | case PrimitiveType::TYPE_NULL: | 46 | 11.6k | return visitor.template apply<PrimitiveType::TYPE_NULL>(field.template get<TYPE_NULL>()); | 47 | 0 | case PrimitiveType::TYPE_DATETIMEV2: | 48 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIMEV2>( | 49 | 0 | field.template get<TYPE_DATETIMEV2>()); | 50 | 0 | case PrimitiveType::TYPE_TIMESTAMP_NS: | 51 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMP_NS>( | 52 | 0 | field.template get<TYPE_TIMESTAMP_NS>()); | 53 | 0 | case PrimitiveType::TYPE_TIMESTAMPTZ: | 54 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMPTZ>( | 55 | 0 | field.template get<TYPE_TIMESTAMPTZ>()); | 56 | 28.6k | case PrimitiveType::TYPE_LARGEINT: | 57 | 28.6k | return visitor.template apply<PrimitiveType::TYPE_LARGEINT>( | 58 | 28.6k | field.template get<TYPE_LARGEINT>()); | 59 | 0 | case PrimitiveType::TYPE_DATETIME: | 60 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIME>( | 61 | 0 | field.template get<TYPE_DATETIME>()); | 62 | 0 | case PrimitiveType::TYPE_DATE: | 63 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATE>(field.template get<TYPE_DATE>()); | 64 | 0 | case PrimitiveType::TYPE_DATEV2: | 65 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATEV2>( | 66 | 0 | field.template get<TYPE_DATEV2>()); | 67 | 57.2k | case PrimitiveType::TYPE_BOOLEAN: | 68 | 57.2k | return visitor.template apply<PrimitiveType::TYPE_BOOLEAN>( | 69 | 57.2k | field.template get<TYPE_BOOLEAN>()); | 70 | 4 | case PrimitiveType::TYPE_TINYINT: | 71 | 4 | return visitor.template apply<PrimitiveType::TYPE_TINYINT>( | 72 | 4 | field.template get<TYPE_TINYINT>()); | 73 | 0 | case PrimitiveType::TYPE_SMALLINT: | 74 | 0 | return visitor.template apply<PrimitiveType::TYPE_SMALLINT>( | 75 | 0 | field.template get<TYPE_SMALLINT>()); | 76 | 531 | case PrimitiveType::TYPE_INT: | 77 | 531 | return visitor.template apply<PrimitiveType::TYPE_INT>(field.template get<TYPE_INT>()); | 78 | 1.49M | case PrimitiveType::TYPE_BIGINT: | 79 | 1.49M | return visitor.template apply<PrimitiveType::TYPE_BIGINT>( | 80 | 1.49M | field.template get<TYPE_BIGINT>()); | 81 | 0 | case PrimitiveType::TYPE_UINT32: | 82 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT32>( | 83 | 0 | field.template get<TYPE_UINT32>()); | 84 | 0 | case PrimitiveType::TYPE_UINT64: | 85 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT64>( | 86 | 0 | field.template get<TYPE_UINT64>()); | 87 | 0 | case PrimitiveType::TYPE_FLOAT: | 88 | 0 | return visitor.template apply<PrimitiveType::TYPE_FLOAT>(field.template get<TYPE_FLOAT>()); | 89 | 0 | case PrimitiveType::TYPE_TIMEV2: | 90 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMEV2>( | 91 | 0 | field.template get<TYPE_TIMEV2>()); | 92 | 186k | case PrimitiveType::TYPE_DOUBLE: | 93 | 186k | return visitor.template apply<PrimitiveType::TYPE_DOUBLE>( | 94 | 186k | field.template get<TYPE_DOUBLE>()); | 95 | 0 | case PrimitiveType::TYPE_IPV4: | 96 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV4>(field.template get<TYPE_IPV4>()); | 97 | 0 | case PrimitiveType::TYPE_IPV6: | 98 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV6>(field.template get<TYPE_IPV6>()); | 99 | 412k | case PrimitiveType::TYPE_STRING: | 100 | 412k | return visitor.template apply<PrimitiveType::TYPE_STRING>( | 101 | 412k | field.template get<TYPE_STRING>()); | 102 | 0 | case PrimitiveType::TYPE_CHAR: | 103 | 0 | return visitor.template apply<PrimitiveType::TYPE_CHAR>(field.template get<TYPE_CHAR>()); | 104 | 0 | case PrimitiveType::TYPE_VARCHAR: | 105 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARCHAR>( | 106 | 0 | field.template get<TYPE_VARCHAR>()); | 107 | 0 | case PrimitiveType::TYPE_VARBINARY: | 108 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARBINARY>( | 109 | 0 | field.template get<TYPE_VARBINARY>()); | 110 | 685k | case PrimitiveType::TYPE_ARRAY: | 111 | 685k | return visitor.template apply<PrimitiveType::TYPE_ARRAY>(field.template get<TYPE_ARRAY>()); | 112 | 0 | case PrimitiveType::TYPE_STRUCT: | 113 | 0 | return visitor.template apply<PrimitiveType::TYPE_STRUCT>( | 114 | 0 | field.template get<TYPE_STRUCT>()); | 115 | 0 | case PrimitiveType::TYPE_MAP: | 116 | 0 | return visitor.template apply<PrimitiveType::TYPE_MAP>(field.template get<TYPE_MAP>()); | 117 | 0 | case PrimitiveType::TYPE_VARIANT: | 118 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARIANT>( | 119 | 0 | field.template get<TYPE_VARIANT>()); | 120 | 0 | case PrimitiveType::TYPE_DECIMAL32: | 121 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL32>( | 122 | 0 | field.template get<TYPE_DECIMAL32>()); | 123 | 0 | case PrimitiveType::TYPE_DECIMAL64: | 124 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL64>( | 125 | 0 | field.template get<TYPE_DECIMAL64>()); | 126 | 0 | case PrimitiveType::TYPE_DECIMALV2: | 127 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMALV2>( | 128 | 0 | field.template get<TYPE_DECIMALV2>()); | 129 | 0 | case PrimitiveType::TYPE_DECIMAL128I: | 130 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL128I>( | 131 | 0 | field.template get<TYPE_DECIMAL128I>()); | 132 | 0 | case PrimitiveType::TYPE_DECIMAL256: | 133 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL256>( | 134 | 0 | field.template get<TYPE_DECIMAL256>()); | 135 | 0 | case PrimitiveType::TYPE_BITMAP: | 136 | 0 | return visitor.template apply<PrimitiveType::TYPE_BITMAP>( | 137 | 0 | field.template get<TYPE_BITMAP>()); | 138 | 0 | case PrimitiveType::TYPE_HLL: | 139 | 0 | return visitor.template apply<PrimitiveType::TYPE_HLL>(field.template get<TYPE_HLL>()); | 140 | 0 | case PrimitiveType::TYPE_QUANTILE_STATE: | 141 | 0 | return visitor.template apply<PrimitiveType::TYPE_QUANTILE_STATE>( | 142 | 0 | field.template get<TYPE_QUANTILE_STATE>()); | 143 | 26 | case PrimitiveType::TYPE_JSONB: | 144 | 26 | return visitor.template apply<PrimitiveType::TYPE_JSONB>(field.template get<TYPE_JSONB>()); | 145 | 0 | default: | 146 | 0 | throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Bad type of Field {}", | 147 | 0 | static_cast<int>(field.get_type())); | 148 | 0 | return {}; | 149 | 2.87M | } | 150 | 2.87M | } |
_ZN5doris13apply_visitorIRNS_12variant_util30SimpleFieldVisitorToScalarTypeERKNS_5FieldEEENSt5decayIT_E4type10ResultTypeEOS8_OT0_ Line | Count | Source | 43 | 17.5M | typename std::decay_t<Visitor>::ResultType apply_visitor(Visitor&& visitor, F&& field) { | 44 | 17.5M | switch (field.get_type()) { | 45 | 106k | case PrimitiveType::TYPE_NULL: | 46 | 106k | return visitor.template apply<PrimitiveType::TYPE_NULL>(field.template get<TYPE_NULL>()); | 47 | 0 | case PrimitiveType::TYPE_DATETIMEV2: | 48 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIMEV2>( | 49 | 0 | field.template get<TYPE_DATETIMEV2>()); | 50 | 0 | case PrimitiveType::TYPE_TIMESTAMP_NS: | 51 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMP_NS>( | 52 | 0 | field.template get<TYPE_TIMESTAMP_NS>()); | 53 | 0 | case PrimitiveType::TYPE_TIMESTAMPTZ: | 54 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMESTAMPTZ>( | 55 | 0 | field.template get<TYPE_TIMESTAMPTZ>()); | 56 | 12.3k | case PrimitiveType::TYPE_LARGEINT: | 57 | 12.3k | return visitor.template apply<PrimitiveType::TYPE_LARGEINT>( | 58 | 12.3k | field.template get<TYPE_LARGEINT>()); | 59 | 0 | case PrimitiveType::TYPE_DATETIME: | 60 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATETIME>( | 61 | 0 | field.template get<TYPE_DATETIME>()); | 62 | 0 | case PrimitiveType::TYPE_DATE: | 63 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATE>(field.template get<TYPE_DATE>()); | 64 | 0 | case PrimitiveType::TYPE_DATEV2: | 65 | 0 | return visitor.template apply<PrimitiveType::TYPE_DATEV2>( | 66 | 0 | field.template get<TYPE_DATEV2>()); | 67 | 255k | case PrimitiveType::TYPE_BOOLEAN: | 68 | 255k | return visitor.template apply<PrimitiveType::TYPE_BOOLEAN>( | 69 | 255k | field.template get<TYPE_BOOLEAN>()); | 70 | 2 | case PrimitiveType::TYPE_TINYINT: | 71 | 2 | return visitor.template apply<PrimitiveType::TYPE_TINYINT>( | 72 | 2 | field.template get<TYPE_TINYINT>()); | 73 | 7 | case PrimitiveType::TYPE_SMALLINT: | 74 | 7 | return visitor.template apply<PrimitiveType::TYPE_SMALLINT>( | 75 | 7 | field.template get<TYPE_SMALLINT>()); | 76 | 718 | case PrimitiveType::TYPE_INT: | 77 | 718 | return visitor.template apply<PrimitiveType::TYPE_INT>(field.template get<TYPE_INT>()); | 78 | 4.87M | case PrimitiveType::TYPE_BIGINT: | 79 | 4.87M | return visitor.template apply<PrimitiveType::TYPE_BIGINT>( | 80 | 4.87M | field.template get<TYPE_BIGINT>()); | 81 | 0 | case PrimitiveType::TYPE_UINT32: | 82 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT32>( | 83 | 0 | field.template get<TYPE_UINT32>()); | 84 | 0 | case PrimitiveType::TYPE_UINT64: | 85 | 0 | return visitor.template apply<PrimitiveType::TYPE_UINT64>( | 86 | 0 | field.template get<TYPE_UINT64>()); | 87 | 1 | case PrimitiveType::TYPE_FLOAT: | 88 | 1 | return visitor.template apply<PrimitiveType::TYPE_FLOAT>(field.template get<TYPE_FLOAT>()); | 89 | 0 | case PrimitiveType::TYPE_TIMEV2: | 90 | 0 | return visitor.template apply<PrimitiveType::TYPE_TIMEV2>( | 91 | 0 | field.template get<TYPE_TIMEV2>()); | 92 | 2.79M | case PrimitiveType::TYPE_DOUBLE: | 93 | 2.79M | return visitor.template apply<PrimitiveType::TYPE_DOUBLE>( | 94 | 2.79M | field.template get<TYPE_DOUBLE>()); | 95 | 0 | case PrimitiveType::TYPE_IPV4: | 96 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV4>(field.template get<TYPE_IPV4>()); | 97 | 0 | case PrimitiveType::TYPE_IPV6: | 98 | 0 | return visitor.template apply<PrimitiveType::TYPE_IPV6>(field.template get<TYPE_IPV6>()); | 99 | 9.42M | case PrimitiveType::TYPE_STRING: | 100 | 9.42M | return visitor.template apply<PrimitiveType::TYPE_STRING>( | 101 | 9.42M | field.template get<TYPE_STRING>()); | 102 | 0 | case PrimitiveType::TYPE_CHAR: | 103 | 0 | return visitor.template apply<PrimitiveType::TYPE_CHAR>(field.template get<TYPE_CHAR>()); | 104 | 0 | case PrimitiveType::TYPE_VARCHAR: | 105 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARCHAR>( | 106 | 0 | field.template get<TYPE_VARCHAR>()); | 107 | 0 | case PrimitiveType::TYPE_VARBINARY: | 108 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARBINARY>( | 109 | 0 | field.template get<TYPE_VARBINARY>()); | 110 | 0 | case PrimitiveType::TYPE_ARRAY: | 111 | 0 | return visitor.template apply<PrimitiveType::TYPE_ARRAY>(field.template get<TYPE_ARRAY>()); | 112 | 0 | case PrimitiveType::TYPE_STRUCT: | 113 | 0 | return visitor.template apply<PrimitiveType::TYPE_STRUCT>( | 114 | 0 | field.template get<TYPE_STRUCT>()); | 115 | 0 | case PrimitiveType::TYPE_MAP: | 116 | 0 | return visitor.template apply<PrimitiveType::TYPE_MAP>(field.template get<TYPE_MAP>()); | 117 | 0 | case PrimitiveType::TYPE_VARIANT: | 118 | 0 | return visitor.template apply<PrimitiveType::TYPE_VARIANT>( | 119 | 0 | field.template get<TYPE_VARIANT>()); | 120 | 0 | case PrimitiveType::TYPE_DECIMAL32: | 121 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL32>( | 122 | 0 | field.template get<TYPE_DECIMAL32>()); | 123 | 0 | case PrimitiveType::TYPE_DECIMAL64: | 124 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL64>( | 125 | 0 | field.template get<TYPE_DECIMAL64>()); | 126 | 0 | case PrimitiveType::TYPE_DECIMALV2: | 127 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMALV2>( | 128 | 0 | field.template get<TYPE_DECIMALV2>()); | 129 | 0 | case PrimitiveType::TYPE_DECIMAL128I: | 130 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL128I>( | 131 | 0 | field.template get<TYPE_DECIMAL128I>()); | 132 | 0 | case PrimitiveType::TYPE_DECIMAL256: | 133 | 0 | return visitor.template apply<PrimitiveType::TYPE_DECIMAL256>( | 134 | 0 | field.template get<TYPE_DECIMAL256>()); | 135 | 0 | case PrimitiveType::TYPE_BITMAP: | 136 | 0 | return visitor.template apply<PrimitiveType::TYPE_BITMAP>( | 137 | 0 | field.template get<TYPE_BITMAP>()); | 138 | 0 | case PrimitiveType::TYPE_HLL: | 139 | 0 | return visitor.template apply<PrimitiveType::TYPE_HLL>(field.template get<TYPE_HLL>()); | 140 | 0 | case PrimitiveType::TYPE_QUANTILE_STATE: | 141 | 0 | return visitor.template apply<PrimitiveType::TYPE_QUANTILE_STATE>( | 142 | 0 | field.template get<TYPE_QUANTILE_STATE>()); | 143 | 46.8k | case PrimitiveType::TYPE_JSONB: | 144 | 46.8k | return visitor.template apply<PrimitiveType::TYPE_JSONB>(field.template get<TYPE_JSONB>()); | 145 | 0 | default: | 146 | 0 | throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Bad type of Field {}", | 147 | 0 | static_cast<int>(field.get_type())); | 148 | 0 | return {}; | 149 | 17.5M | } | 150 | 17.5M | } |
|
151 | | |
152 | | } // namespace doris |