From bbcf8ee42dfac53acc3e530b1b0ecb3d4dd9c9ec Mon Sep 17 00:00:00 2001 From: evenyag Date: Tue, 15 Aug 2023 21:19:28 +0800 Subject: [PATCH] chore: remove some codes --- src/mito2/src/sst/parquet/format.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/mito2/src/sst/parquet/format.rs b/src/mito2/src/sst/parquet/format.rs index e9b90bcdd8bb..4e2f75197b4f 100644 --- a/src/mito2/src/sst/parquet/format.rs +++ b/src/mito2/src/sst/parquet/format.rs @@ -15,9 +15,9 @@ //! Format to store in parquet. //! //! We store three internal columns in parquet: -//! - `__primary_key`, the primary key of the row (tags). -//! - `__sequence`, the sequence number of a row. -//! - `__op_type`, the op type of the row. +//! - `__primary_key`, the primary key of the row (tags). Type: dictionary(uint16, binary) +//! - `__sequence`, the sequence number of a row. Type: uint64 +//! - `__op_type`, the op type of the row. Type: uint8 //! //! The schema of a parquet file is: //! ```text @@ -43,8 +43,6 @@ use crate::error::{ConvertVectorSnafu, InvalidRecordBatchSnafu, NewRecordBatchSn use crate::metadata::RegionMetadata; use crate::read::{Batch, BatchBuilder, BatchColumn}; -/// Number of internal columns. -const INTERNAL_COLUMN_NUM: usize = 3; /// Number of columns that have fixed positions. /// /// Contains: time index and internal columns. @@ -119,7 +117,7 @@ pub(crate) fn from_sst_record_batch( // The record batch must has time index and internal columns. ensure!( - record_batch.num_columns() > INTERNAL_COLUMN_NUM, + record_batch.num_columns() >= FIXED_POS_COLUMN_NUM, InvalidRecordBatchSnafu { reason: format!( "record batch only has {} columns", @@ -234,24 +232,14 @@ fn primary_key_offsets(pk_dict_array: &DictionaryArray) -> Result DataType { - DataType::UInt16 -} - -/// Value type of the primary key. -const fn pk_value_type() -> DataType { - DataType::Binary -} - /// Fields for internal columns. fn internal_fields() -> [FieldRef; 3] { // Internal columns are always not null. [ Arc::new(Field::new_dictionary( PRIMARY_KEY_COLUMN_NAME, - dictionary_key_type(), - pk_value_type(), + DataType::UInt16, + DataType::Binary, false, )), Arc::new(Field::new(SEQUENCE_COLUMN_NAME, DataType::UInt64, false)),