etseidl commented on code in PR #7930: URL: https://github.com/apache/arrow-rs/pull/7930#discussion_r2208357567
########## parquet/src/format.rs: ########## @@ -4984,16 +4984,101 @@ impl crate::thrift::TSerializable for TypeDefinedOrder { // ColumnOrder // +#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct ColumnOrderDisc(i32); + +impl ColumnOrderDisc { + pub const TYPE_ORDER : Self = Self(1); + pub const NO_SUCH_ORDER: Self = Self(2); + pub const ENUM_VALUES: &'static [Self] = &[ + Self::TYPE_ORDER, + ]; +} + +impl From<i32> for ColumnOrderDisc { + fn from(i: i32) -> Self { + match i { + 1 => ColumnOrderDisc::TYPE_ORDER, + 2 => ColumnOrderDisc::NO_SUCH_ORDER, + _ => ColumnOrderDisc(i) + } + } +} + +impl From<&i32> for ColumnOrderDisc { + fn from(i: &i32) -> Self { + ColumnOrderDisc::from(*i) + } +} + +impl From<ColumnOrderDisc> for i32 { + fn from(e: ColumnOrderDisc) -> i32 { + e.0 + } +} + +impl From<&ColumnOrderDisc> for i32 { + fn from(e: &ColumnOrderDisc) -> i32 { + e.0 + } +} + + #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub enum ColumnOrder { - TYPEORDER(TypeDefinedOrder), +#[allow(non_snake_case)] +pub struct ColumnOrder { + pub disc: ColumnOrderDisc, + pub TYPE_ORDER: Option<TypeDefinedOrder>, + pub NO_SUCH_ORDER: Option<TypeDefinedOrder>, Review Comment: Reused `TypeDefinedOrder` because I was too lazy to add another struct for the fake order. -- 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