diff --git a/src/common/src/types/mod.rs b/src/common/src/types/mod.rs index 696d96399ff7d..b8461c29d8625 100644 --- a/src/common/src/types/mod.rs +++ b/src/common/src/types/mod.rs @@ -342,18 +342,6 @@ impl DataType { } } - /// Checks if memcomparable encoding of datatype is equivalent to its value encoding. - pub fn mem_cmp_eq_value_enc(&self) -> bool { - use DataType::*; - match self { - Boolean | Int16 | Int32 | Int64 => true, - Float32 | Float64 | Decimal | Date | Varchar | Time | Timestamp | Timestamptz - | Interval | Bytea => false, - Struct(t) => t.fields.iter().all(|dt| dt.mem_cmp_eq_value_enc()), - List { datatype } => datatype.mem_cmp_eq_value_enc(), - } - } - pub fn new_struct(fields: Vec, field_names: Vec) -> Self { Self::Struct( StructType { diff --git a/src/common/src/util/encoding_for_comparison.rs b/src/common/src/util/encoding_for_comparison.rs index 1682f6eb3b992..415bd47993244 100644 --- a/src/common/src/util/encoding_for_comparison.rs +++ b/src/common/src/util/encoding_for_comparison.rs @@ -17,24 +17,9 @@ use itertools::Itertools; use crate::array::{ArrayImpl, DataChunk}; use crate::error::Result; use crate::row::OwnedRow; -use crate::types::{memcmp_serialize_datum_into, DataType, ScalarRefImpl}; +use crate::types::{memcmp_serialize_datum_into, ScalarRefImpl}; use crate::util::sort_util::{OrderPair, OrderType}; -/// This function is used to check whether we can perform encoding on this type. -/// TODO: based on `memcomparable`, we may support more data type in the future. -pub fn is_type_encodable(t: DataType) -> bool { - matches!( - t, - DataType::Boolean - | DataType::Int16 - | DataType::Int32 - | DataType::Int64 - | DataType::Float32 - | DataType::Float64 - | DataType::Varchar - ) -} - fn encode_value(value: Option>, order: &OrderType) -> Result> { let mut serializer = memcomparable::Serializer::new(vec![]); serializer.set_reverse(order == &OrderType::Descending);