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

Function MakeArrowTimestamp

cpp/src/parquet/arrow/schema_internal.cc:104–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104Result<std::shared_ptr<ArrowType>> MakeArrowTimestamp(const LogicalType& logical_type) {
105 const auto& timestamp = checked_cast<const TimestampLogicalType&>(logical_type);
106 const bool utc_normalized = timestamp.is_adjusted_to_utc();
107 static const char* utc_timezone = "UTC";
108 switch (timestamp.time_unit()) {
109 case LogicalType::TimeUnit::MILLIS:
110 return (utc_normalized ? ::arrow::timestamp(::arrow::TimeUnit::MILLI, utc_timezone)
111 : ::arrow::timestamp(::arrow::TimeUnit::MILLI));
112 case LogicalType::TimeUnit::MICROS:
113 return (utc_normalized ? ::arrow::timestamp(::arrow::TimeUnit::MICRO, utc_timezone)
114 : ::arrow::timestamp(::arrow::TimeUnit::MICRO));
115 case LogicalType::TimeUnit::NANOS:
116 return (utc_normalized ? ::arrow::timestamp(::arrow::TimeUnit::NANO, utc_timezone)
117 : ::arrow::timestamp(::arrow::TimeUnit::NANO));
118 default:
119 return Status::TypeError("Unrecognized time unit in timestamp logical_type: ",
120 logical_type.ToString());
121 }
122}
123
124Result<std::shared_ptr<ArrowType>> FromByteArray(
125 const LogicalType& logical_type, const ArrowReaderProperties& reader_properties,

Callers 1

FromInt64Function · 0.85

Calls 5

timestampFunction · 0.50
TypeErrorFunction · 0.50
is_adjusted_to_utcMethod · 0.45
time_unitMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected