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

Function FromProto

cpp/src/arrow/engine/substrait/type_internal.cc:103–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101} // namespace
102
103Result<std::pair<std::shared_ptr<DataType>, bool>> FromProto(
104 const substrait::Type& type, const ExtensionSet& ext_set,
105 const ConversionOptions& conversion_options) {
106 switch (type.kind_case()) {
107 case substrait::Type::kBool:
108 return FromProtoImpl<BooleanType>(type.bool_());
109
110 case substrait::Type::kI8:
111 return FromProtoImpl<Int8Type>(type.i8());
112 case substrait::Type::kI16:
113 return FromProtoImpl<Int16Type>(type.i16());
114 case substrait::Type::kI32:
115 return FromProtoImpl<Int32Type>(type.i32());
116 case substrait::Type::kI64:
117 return FromProtoImpl<Int64Type>(type.i64());
118
119 case substrait::Type::kFp32:
120 return FromProtoImpl<FloatType>(type.fp32());
121 case substrait::Type::kFp64:
122 return FromProtoImpl<DoubleType>(type.fp64());
123
124 case substrait::Type::kString:
125 return FromProtoImpl<StringType>(type.string());
126 case substrait::Type::kBinary:
127 return FromProtoImpl<BinaryType>(type.binary());
128
129 ARROW_SUPPRESS_DEPRECATION_WARNING
130 case substrait::Type::kTimestamp:
131 return FromProtoImpl<TimestampType>(type.timestamp(), TimeUnit::MICRO);
132 case substrait::Type::kTimestampTz:
133 return FromProtoImpl<TimestampType>(type.timestamp_tz(), TimeUnit::MICRO,
134 TimestampTzTimezoneString());
135 ARROW_UNSUPPRESS_DEPRECATION_WARNING
136 case substrait::Type::kPrecisionTimestamp: {
137 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<DataType> ts_type,
138 precision_timestamp(type.precision_timestamp().precision()));
139 return std::make_pair(ts_type, IsNullable(type.precision_timestamp()));
140 }
141 case substrait::Type::kPrecisionTimestampTz: {
142 ARROW_ASSIGN_OR_RAISE(
143 std::shared_ptr<DataType> ts_type,
144 precision_timestamp_tz(type.precision_timestamp_tz().precision()));
145 return std::make_pair(ts_type, IsNullable(type.precision_timestamp_tz()));
146 }
147 case substrait::Type::kDate:
148 return FromProtoImpl<Date32Type>(type.date());
149
150 case substrait::Type::kTime:
151 return FromProtoImpl<Time64Type>(type.time(), TimeUnit::MICRO);
152
153 case substrait::Type::kIntervalYear:
154 return FromProtoImpl(type.interval_year(), interval_year);
155
156 case substrait::Type::kIntervalDay:
157 return FromProtoImpl(type.interval_day(), interval_day);
158
159 case substrait::Type::kUuid:
160 return FromProtoImpl(type.uuid(), uuid);

Callers 4

FieldsFromProtoFunction · 0.70
DeserializeExpressionsFunction · 0.70
DeserializeSchemaFunction · 0.70
DeserializeExpressionFunction · 0.70

Calls 15

precision_timestampFunction · 0.85
IsNullableFunction · 0.85
precision_timestamp_tzFunction · 0.85
FromProtoImplFunction · 0.85
timeMethod · 0.80
mapMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
InvalidFunction · 0.50
fieldFunction · 0.50
schemaFunction · 0.50
stringMethod · 0.45

Tested by

no test coverage detected