File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
src/query/storages/common/blocks/src Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change 14
14
15
15
use common_arrow:: arrow:: chunk:: Chunk ;
16
16
use common_arrow:: arrow:: datatypes:: DataType as ArrowDataType ;
17
+ use common_arrow:: arrow:: datatypes:: DataType ;
17
18
use common_arrow:: arrow:: io:: parquet:: write:: transverse;
18
19
use common_arrow:: arrow:: io:: parquet:: write:: RowGroupIterator ;
19
20
use common_arrow:: arrow:: io:: parquet:: write:: WriteOptions ;
@@ -92,19 +93,25 @@ pub fn blocks_to_parquet(
92
93
93
94
fn col_encoding ( data_type : & ArrowDataType ) -> Encoding {
94
95
//
95
- match data_type {
96
- ArrowDataType :: Int8
97
- | ArrowDataType :: Int16
98
- | ArrowDataType :: Int32
99
- | ArrowDataType :: Int64
100
- | ArrowDataType :: UInt8
101
- | ArrowDataType :: UInt16
102
- | ArrowDataType :: UInt32
103
- | ArrowDataType :: UInt64 => Encoding :: DeltaBinaryPacked ,
104
- ArrowDataType :: Float16 | ArrowDataType :: Float32 => Encoding :: ByteStreamSplit ,
105
- // | ArrowDataType::LargeBinary
106
- // | ArrowDataType::Utf8
107
- // | ArrowDataType::LargeUtf8 => Encoding::DeltaLengthByteArray,
96
+ let lt = data_type. to_logical_type ( ) ;
97
+ match lt {
98
+ DataType :: Decimal ( p, _) if * p <= 18 => Encoding :: DeltaBinaryPacked ,
99
+
100
+ DataType :: UInt8
101
+ | DataType :: UInt16
102
+ | DataType :: UInt32
103
+ | DataType :: UInt64
104
+ | DataType :: Int8
105
+ | DataType :: Int16
106
+ | DataType :: Int32
107
+ | DataType :: Date32
108
+ | DataType :: Time32 ( _)
109
+ | DataType :: Int64
110
+ | DataType :: Date64
111
+ | DataType :: Time64 ( _)
112
+ | DataType :: Timestamp ( _, _)
113
+ | DataType :: Duration ( _) => Encoding :: DeltaBinaryPacked ,
114
+
108
115
_ => Encoding :: Plain ,
109
116
}
110
117
}
You can’t perform that action at this time.
0 commit comments