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

Method FromThrift

cpp/src/parquet/types.cc:522–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520}
521
522std::shared_ptr<const LogicalType> LogicalType::FromThrift(
523 const format::LogicalType& type) {
524 if (type.__isset.STRING) {
525 return StringLogicalType::Make();
526 } else if (type.__isset.MAP) {
527 return MapLogicalType::Make();
528 } else if (type.__isset.LIST) {
529 return ListLogicalType::Make();
530 } else if (type.__isset.ENUM) {
531 return EnumLogicalType::Make();
532 } else if (type.__isset.DECIMAL) {
533 return DecimalLogicalType::Make(type.DECIMAL.precision, type.DECIMAL.scale);
534 } else if (type.__isset.DATE) {
535 return DateLogicalType::Make();
536 } else if (type.__isset.TIME) {
537 LogicalType::TimeUnit::unit unit;
538 if (type.TIME.unit.__isset.MILLIS) {
539 unit = LogicalType::TimeUnit::MILLIS;
540 } else if (type.TIME.unit.__isset.MICROS) {
541 unit = LogicalType::TimeUnit::MICROS;
542 } else if (type.TIME.unit.__isset.NANOS) {
543 unit = LogicalType::TimeUnit::NANOS;
544 } else {
545 unit = LogicalType::TimeUnit::UNKNOWN;
546 }
547 return TimeLogicalType::Make(type.TIME.isAdjustedToUTC, unit);
548 } else if (type.__isset.TIMESTAMP) {
549 LogicalType::TimeUnit::unit unit;
550 if (type.TIMESTAMP.unit.__isset.MILLIS) {
551 unit = LogicalType::TimeUnit::MILLIS;
552 } else if (type.TIMESTAMP.unit.__isset.MICROS) {
553 unit = LogicalType::TimeUnit::MICROS;
554 } else if (type.TIMESTAMP.unit.__isset.NANOS) {
555 unit = LogicalType::TimeUnit::NANOS;
556 } else {
557 unit = LogicalType::TimeUnit::UNKNOWN;
558 }
559 return TimestampLogicalType::Make(type.TIMESTAMP.isAdjustedToUTC, unit);
560 // TODO(tpboudreau): activate the commented code after parquet.thrift
561 // recognizes IntervalType as a LogicalType
562 //} else if (type.__isset.INTERVAL) {
563 // return IntervalLogicalType::Make();
564 } else if (type.__isset.INTEGER) {
565 return IntLogicalType::Make(static_cast<int>(type.INTEGER.bitWidth),
566 type.INTEGER.isSigned);
567 } else if (type.__isset.UNKNOWN) {
568 return NullLogicalType::Make();
569 } else if (type.__isset.JSON) {
570 return JSONLogicalType::Make();
571 } else if (type.__isset.BSON) {
572 return BSONLogicalType::Make();
573 } else if (type.__isset.UUID) {
574 return UUIDLogicalType::Make();
575 } else if (type.__isset.FLOAT16) {
576 return Float16LogicalType::Make();
577 } else if (type.__isset.GEOMETRY) {
578 std::string crs;
579 if (type.GEOMETRY.__isset.crs) {

Callers

nothing calls this directly

Calls 2

LoadEnumSafeFunction · 0.85
MakeFunction · 0.70

Tested by

no test coverage detected