mapleFU commented on issue #36882: URL: https://github.com/apache/arrow/issues/36882#issuecomment-1659568085
I've seen a piece in `arrow-rs`: ```rust // ---------------------------------------------------------------------- // Encoding support for column writer. // This mirrors parquet-mr default encodings for writes. See: // https://github.com/apache/parquet-mr/blob/master/parquet-column/src/main/java/org/apache/parquet/column/values/factory/DefaultV1ValuesWriterFactory.java // https://github.com/apache/parquet-mr/blob/master/parquet-column/src/main/java/org/apache/parquet/column/values/factory/DefaultV2ValuesWriterFactory.java /// Trait to define default encoding for types, including whether or not the type /// supports dictionary encoding. trait EncodingWriteSupport { /// Returns true if dictionary is supported for column writer, false otherwise. fn has_dictionary_support(props: &WriterProperties) -> bool; } /// Returns encoding for a column when no other encoding is provided in writer properties. fn fallback_encoding(kind: Type, props: &WriterProperties) -> Encoding { match (kind, props.writer_version()) { (Type::BOOLEAN, WriterVersion::PARQUET_2_0) => Encoding::RLE, (Type::INT32, WriterVersion::PARQUET_2_0) => Encoding::DELTA_BINARY_PACKED, (Type::INT64, WriterVersion::PARQUET_2_0) => Encoding::DELTA_BINARY_PACKED, (Type::BYTE_ARRAY, WriterVersion::PARQUET_2_0) => Encoding::DELTA_BYTE_ARRAY, (Type::FIXED_LEN_BYTE_ARRAY, WriterVersion::PARQUET_2_0) => { Encoding::DELTA_BYTE_ARRAY } _ => Encoding::PLAIN, } } /// Returns true if dictionary is supported for column writer, false otherwise. fn has_dictionary_support(kind: Type, props: &WriterProperties) -> bool { match (kind, props.writer_version()) { // Booleans do not support dict encoding and should use a fallback encoding. (Type::BOOLEAN, _) => false, // Dictionary encoding was not enabled in PARQUET 1.0 (Type::FIXED_LEN_BYTE_ARRAY, WriterVersion::PARQUET_1_0) => false, (Type::FIXED_LEN_BYTE_ARRAY, WriterVersion::PARQUET_2_0) => true, _ => true, } } ``` Should we make all of these consistent? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
