| 115 | } |
| 116 | |
| 117 | void 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 | |
| 151 | void ReplaceTypes(const TypeHolder& replacement, std::vector<TypeHolder>* types) { |
| 152 | ReplaceTypes(replacement, types->data(), types->size()); |