| 176 | } |
| 177 | |
| 178 | static std::shared_ptr<const LogicalType> TimestampLogicalTypeFromArrowTimestamp( |
| 179 | const ::arrow::TimestampType& timestamp_type, ::arrow::TimeUnit::type time_unit) { |
| 180 | const bool utc = !(timestamp_type.timezone().empty()); |
| 181 | // ARROW-5878(wesm): for forward compatibility reasons, and because |
| 182 | // there's no other way to signal to old readers that values are |
| 183 | // timestamps, we force the ConvertedType field to be set to the |
| 184 | // corresponding TIMESTAMP_* value. This does cause some ambiguity |
| 185 | // as Parquet readers have not been consistent about the |
| 186 | // interpretation of TIMESTAMP_* values as being UTC-normalized. |
| 187 | switch (time_unit) { |
| 188 | case ::arrow::TimeUnit::MILLI: |
| 189 | return LogicalType::Timestamp(utc, LogicalType::TimeUnit::MILLIS, |
| 190 | /*is_from_converted_type=*/false, |
| 191 | /*force_set_converted_type=*/true); |
| 192 | case ::arrow::TimeUnit::MICRO: |
| 193 | return LogicalType::Timestamp(utc, LogicalType::TimeUnit::MICROS, |
| 194 | /*is_from_converted_type=*/false, |
| 195 | /*force_set_converted_type=*/true); |
| 196 | case ::arrow::TimeUnit::NANO: |
| 197 | return LogicalType::Timestamp(utc, LogicalType::TimeUnit::NANOS, |
| 198 | /*is_from_converted_type=*/false, |
| 199 | /*force_set_converted_type=*/false); |
| 200 | case ::arrow::TimeUnit::SECOND: |
| 201 | // No equivalent parquet logical type. |
| 202 | break; |
| 203 | } |
| 204 | return LogicalType::None(); |
| 205 | } |
| 206 | |
| 207 | static Status GetTimestampMetadata(const ::arrow::TimestampType& type, |
| 208 | const WriterProperties& properties, |
no test coverage detected