MCPcopy Create free account
hub / github.com/apache/arrow / ReplaceTemporalTypes

Function ReplaceTemporalTypes

cpp/src/arrow/compute/kernels/codegen_internal.cc:117–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void ReplaceTemporalTypes(const TimeUnit::type unit, std::vector<TypeHolder>* types) {
118 auto* end = types->data() + types->size();
119
120 for (auto* it = types->data(); it != end; it++) {
121 switch (it->type->id()) {
122 case Type::TIMESTAMP: {
123 const auto& ty = checked_cast<const TimestampType&>(*it->type);
124 *it = timestamp(unit, ty.timezone());
125 continue;
126 }
127 case Type::TIME32:
128 case Type::TIME64: {
129 if (unit > TimeUnit::MILLI) {
130 *it = time64(unit);
131 } else {
132 *it = time32(unit);
133 }
134 continue;
135 }
136 case Type::DURATION: {
137 *it = duration(unit);
138 continue;
139 }
140 case Type::DATE32:
141 case Type::DATE64: {
142 *it = timestamp(unit);
143 continue;
144 }
145 default:
146 continue;
147 }
148 }
149}
150
151void ReplaceTypes(const TypeHolder& replacement, std::vector<TypeHolder>* types) {
152 ReplaceTypes(replacement, types->data(), types->size());

Callers 2

TESTFunction · 0.85
DispatchBestMethod · 0.85

Calls 8

timezoneMethod · 0.80
timestampFunction · 0.50
time64Function · 0.50
time32Function · 0.50
durationFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
idMethod · 0.45

Tested by 1

TESTFunction · 0.68