tustvold commented on code in PR #2849: URL: https://github.com/apache/arrow-rs/pull/2849#discussion_r990623017
########## parquet/src/file/page_index/index.rs: ########## @@ -63,6 +63,44 @@ pub enum Index { FIXED_LEN_BYTE_ARRAY(ByteArrayIndex), } +impl Index { + /// Return min/max elements inside ColumnIndex are ordered or not. + pub fn is_sorted(&self) -> bool { + match self { + Index::NONE => false, + Index::BOOLEAN(x) => check_boundary_is_ordered(&x.boundary_order), + Index::INT32(x) => check_boundary_is_ordered(&x.boundary_order), + Index::INT64(x) => check_boundary_is_ordered(&x.boundary_order), + Index::INT96(x) => check_boundary_is_ordered(&x.boundary_order), + Index::FLOAT(x) => check_boundary_is_ordered(&x.boundary_order), + Index::DOUBLE(x) => check_boundary_is_ordered(&x.boundary_order), + Index::BYTE_ARRAY(x) | Index::FIXED_LEN_BYTE_ARRAY(x) => { + check_boundary_is_ordered(&x.boundary_order) + } + } + } + + /// Get boundary_order of this page index. + pub fn get_boundary_order(&self) -> Option<BoundaryOrder> { + match self { + Index::NONE => None, Review Comment: The explicit coding of NONE is kind of unfortunate, but that ship has probably sailed now -- 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