mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-15 20:40:39 +00:00
fix: Only convert LogicalTypeId to ConcreteDataType in tests (#241)
LogicalTypeId to ConcreteDataType is only allowed in tests, since some additional info is not stored in LogicalTypeId now. It is just an id, or kind, not contains full type info.
This commit is contained in:
@@ -168,7 +168,7 @@ impl AggregateFunctionCreator for DiffAccumulatorCreator {
|
||||
with_match_primitive_type_id!(
|
||||
input_types[0].logical_type_id(),
|
||||
|$S| {
|
||||
Ok(ConcreteDataType::list_datatype(PrimitiveType::<<$S as Primitive>::LargestType>::default().logical_type_id().data_type()))
|
||||
Ok(ConcreteDataType::list_datatype(PrimitiveType::<<$S as Primitive>::LargestType>::default().into()))
|
||||
},
|
||||
{
|
||||
unreachable!()
|
||||
@@ -182,7 +182,7 @@ impl AggregateFunctionCreator for DiffAccumulatorCreator {
|
||||
with_match_primitive_type_id!(
|
||||
input_types[0].logical_type_id(),
|
||||
|$S| {
|
||||
Ok(vec![ConcreteDataType::list_datatype(PrimitiveType::<$S>::default().logical_type_id().data_type())])
|
||||
Ok(vec![ConcreteDataType::list_datatype(PrimitiveType::<$S>::default().into())])
|
||||
},
|
||||
{
|
||||
unreachable!()
|
||||
|
||||
@@ -237,7 +237,7 @@ impl AggregateFunctionCreator for PolyvalAccumulatorCreator {
|
||||
with_match_primitive_type_id!(
|
||||
input_type,
|
||||
|$S| {
|
||||
Ok(PrimitiveType::<<$S as Primitive>::LargestType>::default().logical_type_id().data_type())
|
||||
Ok(PrimitiveType::<<$S as Primitive>::LargestType>::default().into())
|
||||
},
|
||||
{
|
||||
unreachable!()
|
||||
|
||||
@@ -3,6 +3,10 @@ name = "datatypes"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
test = []
|
||||
|
||||
[dependencies.arrow]
|
||||
package = "arrow2"
|
||||
version = "0.10"
|
||||
|
||||
@@ -36,8 +36,12 @@ pub enum LogicalTypeId {
|
||||
}
|
||||
|
||||
impl LogicalTypeId {
|
||||
/// Create ConcreteDataType based on this id. This method is for test only as it
|
||||
/// would lost some info.
|
||||
///
|
||||
/// # Panics
|
||||
/// Panics if data type is not supported.
|
||||
#[cfg(any(test, feature = "test"))]
|
||||
pub fn data_type(&self) -> ConcreteDataType {
|
||||
match self {
|
||||
LogicalTypeId::Null => ConcreteDataType::null_datatype(),
|
||||
|
||||
@@ -37,6 +37,7 @@ uuid = { version = "1.1" , features=["v4"]}
|
||||
[dev-dependencies]
|
||||
atomic_float="0.1"
|
||||
criterion = "0.3"
|
||||
datatypes = { path = "../datatypes", features = ["test"] }
|
||||
rand = "0.8"
|
||||
tempdir = "0.3"
|
||||
|
||||
|
||||
@@ -32,6 +32,5 @@ tempdir = { version = "0.3", optional = true }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
|
||||
[dev-dependencies]
|
||||
datatypes = { path = "../datatypes" }
|
||||
tempdir = { version = "0.3" }
|
||||
tokio = { version = "1.18", features = ["full"] }
|
||||
|
||||
Reference in New Issue
Block a user