@@ -106,6 +106,25 @@ static inline BoundaryOrder::type FromThriftUnsafe(format::BoundaryOrder::type t
106106 return static_cast <BoundaryOrder::type>(type);
107107}
108108
109+ static inline GeometryLogicalType::EdgeInterpolationAlgorithm FromThriftUnsafe (
110+ format::EdgeInterpolationAlgorithm::type type) {
111+ switch (type) {
112+ case format::EdgeInterpolationAlgorithm::SPHERICAL:
113+ return GeometryLogicalType::EdgeInterpolationAlgorithm::SPHERICAL;
114+ case format::EdgeInterpolationAlgorithm::VINCENTY:
115+ return GeometryLogicalType::EdgeInterpolationAlgorithm::VINCENTY;
116+ case format::EdgeInterpolationAlgorithm::THOMAS:
117+ return GeometryLogicalType::EdgeInterpolationAlgorithm::THOMAS;
118+ case format::EdgeInterpolationAlgorithm::ANDOYER:
119+ return GeometryLogicalType::EdgeInterpolationAlgorithm::ANDOYER;
120+ case format::EdgeInterpolationAlgorithm::KARNEY:
121+ return GeometryLogicalType::EdgeInterpolationAlgorithm::KARNEY;
122+ default :
123+ ARROW_DCHECK (false ) << " Cannot reach here" ;
124+ return GeometryLogicalType::EdgeInterpolationAlgorithm::UNKNOWN;
125+ }
126+ }
127+
109128namespace internal {
110129
111130template <typename T>
@@ -221,6 +240,15 @@ inline typename Compression::type LoadEnumSafe(const format::CompressionCodec::t
221240 return FromThriftUnsafe (*in);
222241}
223242
243+ inline typename LogicalType::EdgeInterpolationAlgorithm LoadEnumSafe (
244+ const format::EdgeInterpolationAlgorithm::type* in) {
245+ if (ARROW_PREDICT_FALSE (*in < format::EdgeInterpolationAlgorithm::SPHERICAL ||
246+ *in > format::EdgeInterpolationAlgorithm::KARNEY)) {
247+ return LogicalType::EdgeInterpolationAlgorithm::UNKNOWN;
248+ }
249+ return FromThriftUnsafe (*in);
250+ }
251+
224252// Safe non-enum converters
225253
226254static inline AadMetadata FromThrift (format::AesGcmV1 aesGcmV1) {
@@ -281,25 +309,6 @@ static inline format::EdgeInterpolationAlgorithm::type ToThrift(
281309 }
282310}
283311
284- static inline LogicalType::EdgeInterpolationAlgorithm FromThrift (
285- const format::EdgeInterpolationAlgorithm::type algorithm) {
286- switch (algorithm) {
287- case format::EdgeInterpolationAlgorithm::SPHERICAL:
288- return LogicalType::EdgeInterpolationAlgorithm::SPHERICAL;
289- case format::EdgeInterpolationAlgorithm::VINCENTY:
290- return LogicalType::EdgeInterpolationAlgorithm::VINCENTY;
291- case format::EdgeInterpolationAlgorithm::THOMAS:
292- return LogicalType::EdgeInterpolationAlgorithm::THOMAS;
293- case format::EdgeInterpolationAlgorithm::ANDOYER:
294- return LogicalType::EdgeInterpolationAlgorithm::ANDOYER;
295- case format::EdgeInterpolationAlgorithm::KARNEY:
296- return LogicalType::EdgeInterpolationAlgorithm::KARNEY;
297- default :
298- throw ParquetException (" Unknown value for geometry algorithm: " ,
299- static_cast <int >(algorithm));
300- }
301- }
302-
303312static inline EncryptionAlgorithm FromThrift (format::EncryptionAlgorithm encryption) {
304313 EncryptionAlgorithm encryption_algorithm;
305314
0 commit comments