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

Function GetArrowType

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

Source from the content-addressed store, hash-verified

255}
256
257Result<std::shared_ptr<ArrowType>> GetArrowType(
258 Type::type physical_type, const LogicalType& logical_type, int type_length,
259 const ArrowReaderProperties& reader_properties,
260 const std::shared_ptr<const ::arrow::KeyValueMetadata>& metadata) {
261 if (logical_type.is_null()) {
262 return ::arrow::null();
263 }
264
265 if (logical_type.is_invalid()) {
266 return GetArrowType(physical_type, *NoLogicalType::Make(), type_length,
267 reader_properties);
268 }
269
270 switch (physical_type) {
271 case ParquetType::BOOLEAN:
272 return ::arrow::boolean();
273 case ParquetType::INT32:
274 return FromInt32(logical_type, reader_properties);
275 case ParquetType::INT64:
276 return FromInt64(logical_type, reader_properties);
277 case ParquetType::INT96:
278 return ::arrow::timestamp(reader_properties.coerce_int96_timestamp_unit());
279 case ParquetType::FLOAT:
280 return ::arrow::float32();
281 case ParquetType::DOUBLE:
282 return ::arrow::float64();
283 case ParquetType::BYTE_ARRAY:
284 return FromByteArray(logical_type, reader_properties, metadata);
285 case ParquetType::FIXED_LEN_BYTE_ARRAY:
286 return FromFLBA(logical_type, type_length, reader_properties);
287 default: {
288 // PARQUET-1565: This can occur if the file is corrupt
289 return Status::IOError("Invalid physical column type: ",
290 TypeToString(physical_type));
291 }
292 }
293}
294
295Result<std::shared_ptr<ArrowType>> GetArrowType(
296 const schema::PrimitiveNode& primitive,

Callers 1

GetTypeForNodeFunction · 0.70

Calls 12

FromInt32Function · 0.85
FromByteArrayFunction · 0.85
FromFLBAFunction · 0.85
IOErrorFunction · 0.85
TypeToStringFunction · 0.85
is_nullMethod · 0.80
is_invalidMethod · 0.80
physical_typeMethod · 0.80
type_lengthMethod · 0.80
FromInt64Function · 0.70
MakeFunction · 0.50
timestampFunction · 0.50

Tested by

no test coverage detected