mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-06-03 22:00:38 +00:00
refactor: not allowed int64 type as time index (#2460)
* refactor: remove is_timestamp_compatible. * chore: fmt * refactor: remove int64 to timestamp match * chore * chore: apply suggestions from code review Co-authored-by: dennis zhuang <killme2008@gmail.com> * chore: fmt --------- Co-authored-by: dennis zhuang <killme2008@gmail.com>
This commit is contained in:
@@ -23,7 +23,6 @@ use async_stream::try_stream;
|
||||
use async_trait::async_trait;
|
||||
use common_telemetry::{debug, error};
|
||||
use common_time::range::TimestampRange;
|
||||
use common_time::timestamp::TimeUnit;
|
||||
use common_time::Timestamp;
|
||||
use datatypes::arrow::record_batch::RecordBatch;
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
@@ -162,7 +161,6 @@ fn decode_timestamp_range_inner(
|
||||
let mut end = i64::MIN;
|
||||
|
||||
let unit = match ts_datatype {
|
||||
ConcreteDataType::Int64(_) => TimeUnit::Millisecond,
|
||||
ConcreteDataType::Timestamp(type_) => type_.unit(),
|
||||
_ => {
|
||||
return DecodeParquetTimeRangeSnafu {
|
||||
@@ -358,6 +356,7 @@ mod tests {
|
||||
use api::v1::OpType;
|
||||
use common_base::readable_size::ReadableSize;
|
||||
use common_test_util::temp_dir::create_temp_dir;
|
||||
use common_time::timestamp::TimeUnit;
|
||||
use datatypes::arrow::array::{Array, UInt64Array, UInt8Array};
|
||||
use datatypes::prelude::{ScalarVector, Vector};
|
||||
use datatypes::types::{TimestampMillisecondType, TimestampType};
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use arrow::array::{
|
||||
PrimitiveArray, TimestampMicrosecondArray, TimestampMillisecondArray, TimestampNanosecondArray,
|
||||
TimestampMicrosecondArray, TimestampMillisecondArray, TimestampNanosecondArray,
|
||||
TimestampSecondArray,
|
||||
};
|
||||
use arrow::datatypes::{DataType, Int64Type};
|
||||
use arrow::datatypes::DataType;
|
||||
use arrow::error::ArrowError;
|
||||
use arrow_array::{Array, BooleanArray, RecordBatch};
|
||||
use common_time::range::TimestampRange;
|
||||
@@ -45,7 +45,6 @@ pub(crate) fn build_row_filter(
|
||||
let ts_col_idx = store_schema.timestamp_index();
|
||||
let ts_col = store_schema.columns().get(ts_col_idx)?;
|
||||
let ts_col_unit = match &ts_col.desc.data_type {
|
||||
ConcreteDataType::Int64(_) => TimeUnit::Millisecond,
|
||||
ConcreteDataType::Timestamp(ts_type) => ts_type.unit(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
@@ -205,7 +204,6 @@ impl ArrowPredicate for FastTimestampRowFilter {
|
||||
downcast_and_compute!(TimestampNanosecondArray)
|
||||
}
|
||||
},
|
||||
DataType::Int64 => downcast_and_compute!(PrimitiveArray<Int64Type>),
|
||||
_ => {
|
||||
unreachable!()
|
||||
}
|
||||
@@ -270,9 +268,6 @@ impl ArrowPredicate for PlainTimestampRowFilter {
|
||||
downcast_and_compute!(TimestampNanosecondArray, Nanosecond)
|
||||
}
|
||||
},
|
||||
DataType::Int64 => {
|
||||
downcast_and_compute!(PrimitiveArray<Int64Type>, Millisecond)
|
||||
}
|
||||
_ => {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user