fix: deserialize TableInfoValue with missing field (#2134)

This commit is contained in:
LFC
2023-08-10 10:43:24 +08:00
committed by GitHub
parent 7abe71f399
commit ea3708b33d
8 changed files with 14 additions and 6 deletions

View File

@@ -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());

View File

@@ -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]