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

Method FromThrift

cpp/src/parquet/types.cc:534–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

LoadEnumSafeFunction · 0.85
MakeFunction · 0.70

Tested by

no test coverage detected