mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-14 09:12:57 +00:00
fix: deserialize TableInfoValue with missing field (#2134)
This commit is contained in:
@@ -33,7 +33,7 @@ metrics.workspace = true
|
||||
moka = { version = "0.11", features = ["future"] }
|
||||
parking_lot = "0.12"
|
||||
regex.workspace = true
|
||||
serde = "1.0"
|
||||
serde.workspace = true
|
||||
serde_json = "1.0"
|
||||
session = { workspace = true }
|
||||
snafu = { version = "0.7", features = ["backtraces"] }
|
||||
|
||||
@@ -161,6 +161,13 @@ mod tests {
|
||||
use crate::kv_backend::KvBackend;
|
||||
use crate::rpc::store::PutRequest;
|
||||
|
||||
#[test]
|
||||
fn test_deserialization_compatibility() {
|
||||
let s = r#"{"version":1,"table_info":{"ident":{"table_id":8714,"version":0},"name":"go_gc_duration_seconds","desc":"Created on insertion","catalog_name":"e87lehzy63d4cloud_docs_test","schema_name":"public","meta":{"schema":{"column_schemas":[{"name":"instance","data_type":{"String":null},"is_nullable":true,"is_time_index":false,"default_constraint":null,"metadata":{}},{"name":"job","data_type":{"String":null},"is_nullable":true,"is_time_index":false,"default_constraint":null,"metadata":{}},{"name":"quantile","data_type":{"String":null},"is_nullable":true,"is_time_index":false,"default_constraint":null,"metadata":{}},{"name":"greptime_timestamp","data_type":{"Timestamp":{"Millisecond":null}},"is_nullable":false,"is_time_index":true,"default_constraint":null,"metadata":{"greptime:time_index":"true"}},{"name":"greptime_value","data_type":{"Float64":{}},"is_nullable":true,"is_time_index":false,"default_constraint":null,"metadata":{}}],"timestamp_index":3,"version":0},"primary_key_indices":[0,1,2],"value_indices":[],"engine":"mito","next_column_id":5,"region_numbers":[],"engine_options":{},"options":{"write_buffer_size":null,"ttl":null,"extra_options":{}},"created_on":"1970-01-01T00:00:00Z"},"table_type":"Base"}}"#;
|
||||
let v = TableInfoValue::try_from_raw_value(s.as_bytes().to_vec()).unwrap();
|
||||
assert!(v.table_info.meta.partition_key_indices.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_table_info_manager() {
|
||||
let backend = Arc::new(MemoryKvBackend::default());
|
||||
|
||||
@@ -11,7 +11,7 @@ datafusion.workspace = true
|
||||
datatypes = { workspace = true }
|
||||
futures.workspace = true
|
||||
paste = "1.0"
|
||||
serde = "1.0"
|
||||
serde.workspace = true
|
||||
snafu = { version = "0.7", features = ["backtraces"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -51,7 +51,7 @@ pin-project = "1.0"
|
||||
prost.workspace = true
|
||||
query = { workspace = true }
|
||||
secrecy = { version = "0.8", features = ["serde", "alloc"] }
|
||||
serde = "1.0"
|
||||
serde.workspace = true
|
||||
serde_json = "1.0"
|
||||
servers = { workspace = true }
|
||||
session = { workspace = true }
|
||||
|
||||
@@ -55,7 +55,7 @@ prost.workspace = true
|
||||
query = { workspace = true }
|
||||
regex.workspace = true
|
||||
script = { workspace = true, features = ["python"], optional = true }
|
||||
serde = "1.0"
|
||||
serde.workspace = true
|
||||
serde_json = "1.0"
|
||||
servers = { workspace = true }
|
||||
session = { workspace = true }
|
||||
|
||||
@@ -40,7 +40,7 @@ parking_lot = "0.12"
|
||||
prost.workspace = true
|
||||
rand.workspace = true
|
||||
regex.workspace = true
|
||||
serde = "1.0"
|
||||
serde.workspace = true
|
||||
serde_json = "1.0"
|
||||
servers = { workspace = true }
|
||||
snafu.workspace = true
|
||||
|
||||
@@ -29,7 +29,7 @@ futures.workspace = true
|
||||
humantime = "2.1"
|
||||
humantime-serde = "1.1"
|
||||
paste = "1.0"
|
||||
serde = "1.0.136"
|
||||
serde.workspace = true
|
||||
snafu = { version = "0.7", features = ["backtraces"] }
|
||||
store-api = { workspace = true }
|
||||
tokio.workspace = true
|
||||
|
||||
@@ -520,6 +520,7 @@ pub struct RawTableMeta {
|
||||
pub engine_options: HashMap<String, String>,
|
||||
pub options: TableOptions,
|
||||
pub created_on: DateTime<Utc>,
|
||||
#[serde(default)]
|
||||
pub partition_key_indices: Vec<usize>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user