mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-06-02 13:20:40 +00:00
feat: impl timestamp type, value and vectors (#226)
* wip: impl timestamp data type * add timestamp vectors * adapt to recent changes to vector module * fix all unit test * rebase develop * fix slice * change default time unit to millisecond * add more tests * fix some CR comments * fix some CR comments * fix clippy * fix some cr comments * fix some CR comments * fix some CR comments * remove time unit in LogicalTypeId::Timestamp
This commit is contained in:
@@ -16,6 +16,7 @@ common-error = { path = "../common/error" }
|
||||
common-query = { path = "../common/query" }
|
||||
common-recordbatch = { path = "../common/recordbatch" }
|
||||
common-telemetry = { path = "../common/telemetry" }
|
||||
common-time = { path = "../common/time" }
|
||||
datafusion-common = { git = "https://github.com/apache/arrow-datafusion.git", branch = "arrow2" }
|
||||
datatypes = { path = "../datatypes" }
|
||||
futures = "0.3"
|
||||
|
||||
@@ -419,7 +419,7 @@ mod tests {
|
||||
use common_recordbatch::util;
|
||||
use datafusion_common::field_util::FieldExt;
|
||||
use datafusion_common::field_util::SchemaExt;
|
||||
use datatypes::prelude::ConcreteDataType;
|
||||
use datatypes::prelude::{ConcreteDataType, ScalarVector};
|
||||
use datatypes::schema::ColumnSchema;
|
||||
use datatypes::vectors::*;
|
||||
use store_api::manifest::Manifest;
|
||||
@@ -461,7 +461,7 @@ mod tests {
|
||||
let hosts = StringVector::from(vec!["host1", "host2"]);
|
||||
let cpus = Float64Vector::from_vec(vec![55.5, 66.6]);
|
||||
let memories = Float64Vector::from_vec(vec![1024f64, 4096f64]);
|
||||
let tss = Int64Vector::from_vec(vec![1, 2]);
|
||||
let tss = TimestampVector::from_vec(vec![1, 2]);
|
||||
|
||||
columns_values.insert("host".to_string(), Arc::new(hosts.clone()));
|
||||
columns_values.insert("cpu".to_string(), Arc::new(cpus.clone()));
|
||||
@@ -541,7 +541,7 @@ mod tests {
|
||||
let hosts = StringVector::from(vec!["host1"; test_batch_size]);
|
||||
let cpus = Float64Vector::from_vec(vec![55.5; test_batch_size]);
|
||||
let memories = Float64Vector::from_vec(vec![1024f64; test_batch_size]);
|
||||
let tss = Int64Vector::from_vec((0..test_batch_size).map(|v| v as i64).collect());
|
||||
let tss = TimestampVector::from_values((0..test_batch_size).map(|v| v as i64));
|
||||
|
||||
columns_values.insert("host".to_string(), Arc::new(hosts));
|
||||
columns_values.insert("cpu".to_string(), Arc::new(cpus));
|
||||
|
||||
@@ -29,7 +29,11 @@ pub fn schema_for_test() -> Schema {
|
||||
ColumnSchema::new("host", ConcreteDataType::string_datatype(), false),
|
||||
ColumnSchema::new("cpu", ConcreteDataType::float64_datatype(), true),
|
||||
ColumnSchema::new("memory", ConcreteDataType::float64_datatype(), true),
|
||||
ColumnSchema::new("ts", ConcreteDataType::int64_datatype(), true),
|
||||
ColumnSchema::new(
|
||||
"ts",
|
||||
ConcreteDataType::timestamp_datatype(common_time::timestamp::TimeUnit::Millisecond),
|
||||
true,
|
||||
),
|
||||
];
|
||||
|
||||
SchemaBuilder::from(column_schemas)
|
||||
|
||||
Reference in New Issue
Block a user