Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dantengsky committed Sep 22, 2023
1 parent 9f1b21e commit 2036ddc
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/query/storages/common/blocks/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use common_arrow::arrow::chunk::Chunk;
use common_arrow::arrow::datatypes::DataType as ArrowDataType;
use common_arrow::arrow::datatypes::DataType;
use common_arrow::arrow::io::parquet::write::transverse;
use common_arrow::arrow::io::parquet::write::RowGroupIterator;
use common_arrow::arrow::io::parquet::write::WriteOptions;
Expand Down Expand Up @@ -92,19 +93,25 @@ pub fn blocks_to_parquet(

fn col_encoding(data_type: &ArrowDataType) -> Encoding {
//
match data_type {
ArrowDataType::Int8
| ArrowDataType::Int16
| ArrowDataType::Int32
| ArrowDataType::Int64
| ArrowDataType::UInt8
| ArrowDataType::UInt16
| ArrowDataType::UInt32
| ArrowDataType::UInt64 => Encoding::DeltaBinaryPacked,
ArrowDataType::Float16 | ArrowDataType::Float32 => Encoding::ByteStreamSplit,
// | ArrowDataType::LargeBinary
// | ArrowDataType::Utf8
// | ArrowDataType::LargeUtf8 => Encoding::DeltaLengthByteArray,
let lt = data_type.to_logical_type();
match lt {
DataType::Decimal(p, _) if *p <= 18 => Encoding::DeltaBinaryPacked,

DataType::UInt8
| DataType::UInt16
| DataType::UInt32
| DataType::UInt64
| DataType::Int8
| DataType::Int16
| DataType::Int32
| DataType::Date32
| DataType::Time32(_)
| DataType::Int64
| DataType::Date64
| DataType::Time64(_)
| DataType::Timestamp(_, _)
| DataType::Duration(_) => Encoding::DeltaBinaryPacked,

_ => Encoding::Plain,
}
}

0 comments on commit 2036ddc

Please sign in to comment.