etseidl commented on code in PR #8072:
URL: https://github.com/apache/arrow-rs/pull/8072#discussion_r2258503812


##########
parquet/src/basic.rs:
##########
@@ -165,23 +161,151 @@ pub enum ConvertedType {
     INTERVAL,
 }
 
+impl<'a> TryFrom<&mut ThriftCompactInputProtocol<'a>> for ConvertedType {
+    type Error = ParquetError;
+    fn try_from(prot: &mut ThriftCompactInputProtocol<'a>) -> Result<Self> {
+        let val = prot.read_i32()?;
+        Ok(match val {
+            0 => Self::UTF8,
+            1 => Self::MAP,
+            2 => Self::MAP_KEY_VALUE,
+            3 => Self::LIST,
+            4 => Self::ENUM,
+            5 => Self::DECIMAL,
+            6 => Self::DATE,
+            7 => Self::TIME_MILLIS,
+            8 => Self::TIME_MICROS,
+            9 => Self::TIMESTAMP_MILLIS,
+            10 => Self::TIMESTAMP_MICROS,
+            11 => Self::UINT_8,
+            12 => Self::UINT_16,
+            13 => Self::UINT_32,
+            14 => Self::UINT_64,
+            15 => Self::INT_8,
+            16 => Self::INT_16,
+            17 => Self::INT_32,
+            18 => Self::INT_64,
+            19 => Self::JSON,
+            20 => Self::BSON,
+            21 => Self::INTERVAL,
+            _ => return Err(general_err!("Unexpected ConvertedType {}", val)),
+        })
+    }
+}
+
 // ----------------------------------------------------------------------
 // Mirrors thrift union `crate::format::TimeUnit`
 
+thrift_union_all_empty!(
 /// Time unit for `Time` and `Timestamp` logical types.
-#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum TimeUnit {
-    /// Milliseconds.
-    MILLIS,
-    /// Microseconds.
-    MICROS,
-    /// Nanoseconds.
-    NANOS,
+union TimeUnit {
+  1: MilliSeconds MILLIS
+  2: MicroSeconds MICROS
+  3: NanoSeconds NANOS
 }
+);
 
 // ----------------------------------------------------------------------
 // Mirrors thrift union `crate::format::LogicalType`
 
+// private structs for decoding logical type

Review Comment:
   These are only used when parsing the `LogicalType` union, so they're kept 
private to this module. The `LogicalType` rust enum uses struct variants, so 
these don't need to be exposed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to