Skip to content

Commit 4c127d7

Browse files
committed
enable some encodings
1 parent 3519624 commit 4c127d7

File tree

1 file changed

+22
-12
lines changed
  • src/query/storages/common/blocks/src

1 file changed

+22
-12
lines changed

src/query/storages/common/blocks/src/block.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,26 @@ pub fn blocks_to_parquet(
9090
}
9191
}
9292

93-
fn col_encoding(_data_type: &ArrowDataType) -> Encoding {
94-
// Although encoding does work, parquet2 has not implemented decoding of DeltaLengthByteArray yet, we fallback to Plain
95-
// From parquet2: Decoding "DeltaLengthByteArray"-encoded required V2 pages is not yet implemented for Binary.
96-
//
97-
// match data_type {
98-
// ArrowDataType::Binary
99-
// | ArrowDataType::LargeBinary
100-
// | ArrowDataType::Utf8
101-
// | ArrowDataType::LargeUtf8 => Encoding::DeltaLengthByteArray,
102-
// _ => Encoding::Plain,
103-
//}
104-
Encoding::Plain
93+
fn col_encoding(data_type: &ArrowDataType) -> Encoding {
94+
use common_arrow::arrow::datatypes::DataType;
95+
let lt = data_type.to_logical_type();
96+
match lt {
97+
DataType::Decimal(p, _) if *p <= 18 => Encoding::DeltaBinaryPacked,
98+
DataType::UInt8
99+
| DataType::UInt16
100+
| DataType::UInt32
101+
| DataType::UInt64
102+
| DataType::Int8
103+
| DataType::Int16
104+
| DataType::Int32
105+
| DataType::Date32
106+
| DataType::Time32(_)
107+
| DataType::Int64
108+
| DataType::Date64
109+
| DataType::Time64(_)
110+
| DataType::Timestamp(_, _)
111+
| DataType::Duration(_) => Encoding::DeltaBinaryPacked,
112+
113+
_ => Encoding::Plain,
114+
}
105115
}

0 commit comments

Comments
 (0)