feat(dameng): show view validity and support recompilation

This commit is contained in:
guan xin authored and GitHub committed 2026-09-17 19:30:44 +08:00
1 parent e4bda693fb
commit 6b81a98453
71 files changed
+1040 -38

No files matched your search

+1
View File
@@ -4036,6 +4036,7 @@ mod tests {
TableInfo {
name: name.to_string(),
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -563,6 +563,7 @@ fn clickhouse_table_info_from_row(row: &[serde_json::Value]) -> TableInfo {
TableInfo {
name: row.first().and_then(|v| v.as_str()).unwrap_or("").to_string(),
table_type: table_type.to_string(),
valid: None,
comment: row.get(2).and_then(|v| v.as_str()).filter(|value| !value.is_empty()).map(str::to_string),
parent_schema: None,
parent_name: None,
@@ -128,6 +128,7 @@ pub async fn list_tables(client: &CloudflareD1Client, _schema: &str) -> Result<V
TableInfo {
name: value_as_string(row.first()).unwrap_or_default(),
table_type: if table_type.eq_ignore_ascii_case("view") { "VIEW" } else { "BASE TABLE" }.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+3
View File
@@ -189,6 +189,7 @@ mod tests {
TableInfo {
name: "dolt_log".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -196,6 +197,7 @@ mod tests {
TableInfo {
name: "DOLT_BRANCHES".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -203,6 +205,7 @@ mod tests {
TableInfo {
name: "orders".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: Some("ordinary".to_string()),
parent_schema: None,
parent_name: None,
+1
View File
@@ -245,6 +245,7 @@ pub async fn list_tables(client: &HBaseClient, namespace: &str) -> Result<Vec<Ta
.map(|name| TableInfo {
name,
table_type: "HBASE_TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -268,6 +268,7 @@ pub async fn list_tables(client: &Influxdb3Client, database: &str) -> Result<Vec
Some(TableInfo {
name,
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -402,6 +402,7 @@ pub async fn list_tables(client: &InfluxdbClient, database: &str) -> Result<Vec<
.map(|name| TableInfo {
name,
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -421,6 +422,7 @@ pub async fn list_tables(client: &InfluxdbClient, database: &str) -> Result<Vec<
.map(|row| TableInfo {
name: row[0].as_str().unwrap_or("").to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+6 -1
View File
@@ -2470,6 +2470,7 @@ pub async fn list_tables_filtered(
(!name.is_empty()).then_some(TableInfo {
name,
table_type: normalize_mysql_table_type(&get_str_by_name(row, "TABLE_TYPE")),
valid: None,
comment: get_opt_str(row, "TABLE_COMMENT")
.map(|s| fix_potential_double_encoding(&s))
.filter(|s| !s.is_empty()),
@@ -2976,7 +2977,7 @@ fn table_infos_from_show_rows(rows: &[mysql_async::Row]) -> Vec<TableInfo> {
return None;
}
let table_type = normalize_mysql_table_type(&get_str(row, 1));
Some(TableInfo { name, table_type, comment: None, parent_schema: None, parent_name: None })
Some(TableInfo { name, table_type, valid: None, comment: None, parent_schema: None, parent_name: None })
})
.collect::<Vec<_>>();
tables.sort_by(|a, b| a.name.cmp(&b.name));
@@ -6927,6 +6928,7 @@ mod tests {
TableInfo {
name: "audit_2024".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -6934,6 +6936,7 @@ mod tests {
TableInfo {
name: "audit_view".to_string(),
table_type: "VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -6941,6 +6944,7 @@ mod tests {
TableInfo {
name: "audit_2025".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: Some("purchase order history".to_string()),
parent_schema: None,
parent_name: None,
@@ -6954,6 +6958,7 @@ mod tests {
let rows = vec![TableInfo {
name: "t_0001".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: Some("food orders".to_string()),
parent_schema: None,
parent_name: None,
@@ -152,6 +152,7 @@ pub async fn list_tables_show_from(pool: &MySqlPool, catalog: &str, database: &s
Some(TableInfo {
name,
table_type: if table_type.trim().is_empty() { "TABLE".to_string() } else { table_type },
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -81,6 +81,7 @@ pub async fn list_tables(pool: &mysql_async::Pool, schema: &str) -> Result<Vec<T
.map(|row| TableInfo {
name: get_str(row, 0),
table_type: get_str(row, 1),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -62,6 +62,7 @@ fn merge_materialized_views(
tables.push(TableInfo {
name,
table_type: "VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -227,6 +228,7 @@ mod tests {
TableInfo {
name: name.to_string(),
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -3501,6 +3501,7 @@ async fn list_tables_filtered_by_kind(
.map(|row| TableInfo {
name: pg_row_try_string(row, 0),
table_type: pg_row_try_string(row, 1),
valid: None,
comment: row.try_get::<_, Option<String>>(2).ok().flatten().filter(|s| !s.is_empty()),
parent_schema: row.try_get::<_, Option<String>>(3).ok().flatten().filter(|s| !s.is_empty()),
parent_name: row.try_get::<_, Option<String>>(4).ok().flatten().filter(|s| !s.is_empty()),
+3
View File
@@ -65,6 +65,7 @@ async fn list_tables_new_version(pool: &Pool, _schema: &str) -> Result<Vec<Table
TableInfo {
name: row.get::<_, String>(0),
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -91,6 +92,7 @@ async fn list_tables_mat_view_version(pool: &Pool, _schema: &str) -> Result<Vec<
TableInfo {
name: row.get::<_, String>(0),
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -113,6 +115,7 @@ async fn list_tables_basic(pool: &Pool, _schema: &str) -> Result<Vec<TableInfo>,
.map(|row| TableInfo {
name: row.get::<_, String>(0),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -115,6 +115,7 @@ pub async fn list_tables(client: &RqliteClient, _schema: &str) -> Result<Vec<Tab
TableInfo {
name: value_as_string(row.first()).unwrap_or_default(),
table_type: if table_type.eq_ignore_ascii_case("view") { "VIEW" } else { "BASE TABLE" }.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+2
View File
@@ -1520,6 +1520,7 @@ pub async fn list_tables(pool: &SqliteHandle, schema: &str) -> Result<Vec<TableI
TableInfo {
name: json_cell_text(&row, 0),
table_type: if table_type == "view" { "VIEW".to_string() } else { "BASE TABLE".to_string() },
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -1544,6 +1545,7 @@ pub async fn list_tables(pool: &SqliteHandle, schema: &str) -> Result<Vec<TableI
Ok(TableInfo {
name: row.get(0)?,
table_type: if table_type == "view" { "VIEW".to_string() } else { "BASE TABLE".to_string() },
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+2
View File
@@ -2136,6 +2136,7 @@ pub async fn list_linked_server_tables(
.map(|row| TableInfo {
name: row.name,
table_type: normalize_linked_server_table_type(row.table_type.as_deref()),
valid: None,
comment: row.comment,
parent_schema: None,
parent_name: None,
@@ -2335,6 +2336,7 @@ async fn list_tables_by_kind(
.map(|row| TableInfo {
name: row.get::<&str, _>(0).unwrap_or("").to_string(),
table_type: row.get::<&str, _>(1).unwrap_or("BASE TABLE").to_string(),
valid: None,
comment: row.get::<&str, _>(2).filter(|s: &&str| !s.is_empty()).map(|s: &str| s.to_string()),
parent_schema: None,
parent_name: None,
+2
View File
@@ -110,6 +110,7 @@ fn merge_materialized_views(
tables.push(TableInfo {
name: name.clone(),
table_type: "MATERIALIZED_VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -245,6 +246,7 @@ mod tests {
TableInfo {
name: name.to_string(),
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -157,6 +157,7 @@ pub async fn list_tables(client: &TursoClient, _schema: &str) -> Result<Vec<Tabl
TableInfo {
name: value_as_string(row.first()).unwrap_or_default(),
table_type: if table_type.eq_ignore_ascii_case("view") { "VIEW" } else { "BASE TABLE" }.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -221,6 +221,7 @@ pub async fn list_tables(client: &VictoriaMetricsClient) -> Result<Vec<TableInfo
.map(|name| TableInfo {
name,
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+12
View File
@@ -2303,6 +2303,7 @@ fn message_queue_topic_tables(topics: Vec<crate::mq::TopicInfo>) -> Vec<db::Tabl
.map(|topic| db::TableInfo {
name: topic.name,
table_type: "TOPIC".to_string(),
valid: None,
comment: None,
parent_schema: topic.namespace,
parent_name: None,
@@ -2762,6 +2763,7 @@ fn collection_names_to_tables(names: Vec<String>, table_type: &str) -> Vec<db::T
.map(|name| db::TableInfo {
name,
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -3045,6 +3047,7 @@ fn presto_like_tables_from_query_result(result: &db::QueryResult) -> Vec<db::Tab
table_type: normalize_information_schema_table_type(
query_result_cell_string(row, 1).as_deref().unwrap_or("TABLE"),
),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -4733,6 +4736,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -4902,6 +4906,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "t_order_view".to_string(),
table_type: "VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5028,6 +5033,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "active_orders".to_string(),
table_type: "VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5036,6 +5042,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "active_users".to_string(),
table_type: "VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5056,6 +5063,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "orders_view".to_string(),
table_type: "VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5063,6 +5071,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "daily_orders_mv".to_string(),
table_type: "MATERIALIZED_VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5070,6 +5079,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "monthly_orders_mv".to_string(),
table_type: "MATERIALIZED_VIEW".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5816,6 +5826,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "ORDERS".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -5823,6 +5834,7 @@ for line in sys.stdin:
super::db::TableInfo {
name: "PRODUCTS".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: Some("Existing".to_string()),
parent_schema: None,
parent_name: None,
@@ -298,6 +298,7 @@ mod tests {
db::TableInfo {
name: "USERS".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -305,6 +306,7 @@ mod tests {
db::TableInfo {
name: "BIN$abc123==$0".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -322,6 +322,7 @@ fn collection_names_to_tables(names: Vec<String>, table_type: &str) -> Vec<db::T
.map(|name| db::TableInfo {
name,
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+27
View File
@@ -6203,6 +6203,7 @@ mod tests {
TableInfo {
name: name.to_string(),
table_type: table_type.to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9065,6 +9066,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: Some("用户表".to_string()),
parent_schema: None,
parent_name: None,
@@ -9072,6 +9074,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: Some("Users".to_string()),
parent_schema: None,
parent_name: None,
@@ -9119,6 +9122,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9126,6 +9130,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9444,6 +9449,7 @@ mod tests {
TableInfo {
name: "orders".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9451,6 +9457,7 @@ mod tests {
TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9512,6 +9519,7 @@ mod tests {
TableInfo {
name: "order_items".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9519,6 +9527,7 @@ mod tests {
TableInfo {
name: "orders".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9526,6 +9535,7 @@ mod tests {
TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9929,6 +9939,7 @@ mod tests {
target_tables: vec![TableInfo {
name: table_name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: table_comment.map(str::to_string),
parent_schema: None,
parent_name: None,
@@ -10445,6 +10456,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "users_old".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -10452,6 +10464,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "users_new".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -10502,6 +10515,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "new_table".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -11101,6 +11115,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "users".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -11108,6 +11123,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "users".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -11154,6 +11170,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -11161,6 +11178,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -11620,6 +11638,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: Some("new".into()),
parent_schema: None,
parent_name: None,
@@ -11627,6 +11646,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: Some("old".into()),
parent_schema: None,
parent_name: None,
@@ -12113,6 +12133,7 @@ mod tests {
TableInfo {
name: "sys_organization".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -12120,6 +12141,7 @@ mod tests {
TableInfo {
name: "sys_user".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -12230,6 +12252,7 @@ mod tests {
let table_infos = vec![TableInfo {
name: "orders".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -12474,6 +12497,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: Some("new_comment".into()),
parent_schema: None,
parent_name: None,
@@ -12481,6 +12505,7 @@ mod tests {
target_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: Some("old_comment".into()),
parent_schema: None,
parent_name: None,
@@ -12592,6 +12617,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -13122,6 +13148,7 @@ mod tests {
source_tables: vec![TableInfo {
name: "t".into(),
table_type: "BASE TABLE".into(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -1422,6 +1422,7 @@ mod tests {
TableInfo {
name: name.to_string(),
table_type: "table".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -10826,6 +10826,7 @@ CREATE TABLE "Other"."prefix""Source"."NAME" ("ID" INT);"#;
db::TableInfo {
name: name.to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+36 -1
View File
@@ -106,6 +106,8 @@ impl CatalogInfo {
pub struct TableInfo {
pub name: String,
pub table_type: String, // "TABLE" or "VIEW"
#[serde(default, skip_serializing_if = "Option::is_none")]
pub valid: Option<bool>,
pub comment: Option<String>,
pub parent_schema: Option<String>,
pub parent_name: Option<String>,
@@ -856,7 +858,7 @@ pub struct CustomTypeDetails {
mod tests {
use super::{
CompletionAssistantCandidate, CompletionAssistantCandidateKind, ObjectInfo, ObjectSourceKind, QueryMessage,
SpatialColumn, SpatialColumnBuilder,
SpatialColumn, SpatialColumnBuilder, TableInfo,
};
#[test]
@@ -956,6 +958,39 @@ mod tests {
assert_eq!(objects[1].xugu_type_members_expandable, Some(true));
}
#[test]
fn dameng_table_validity_round_trips_true_false_and_unknown() {
for validity in [Some(true), Some(false), None] {
let payload = serde_json::json!({"name": "VIEW_A", "table_type": "VIEW", "valid": validity});
let table: TableInfo = serde_json::from_value(payload).unwrap();
assert_eq!(table.valid, validity);
let encoded = serde_json::to_value(&table).unwrap();
assert_eq!(encoded.get("valid").and_then(serde_json::Value::as_bool), validity);
assert_eq!(encoded.get("valid").is_some(), validity.is_some());
let decoded: TableInfo = serde_json::from_value(encoded).unwrap();
assert_eq!(decoded.valid, validity);
}
let legacy: TableInfo = serde_json::from_str(r#"{"name":"TABLE_A","table_type":"TABLE"}"#).unwrap();
assert_eq!(legacy.valid, None);
}
#[test]
fn dameng_object_validity_round_trips_true_false_and_unknown() {
for validity in [Some(true), Some(false), None] {
let payload =
serde_json::json!({"name": "VIEW_A", "object_type": "VIEW", "schema": "APP", "valid": validity});
let object: ObjectInfo = serde_json::from_value(payload).unwrap();
assert_eq!(object.valid, validity);
let encoded = serde_json::to_value(&object).unwrap();
assert_eq!(encoded.get("valid").and_then(serde_json::Value::as_bool), validity);
assert_eq!(encoded.get("valid").is_some(), validity.is_some());
let decoded: ObjectInfo = serde_json::from_value(encoded).unwrap();
assert_eq!(decoded.valid, validity);
}
let legacy: ObjectInfo = serde_json::from_str(r#"{"name":"TABLE_A","object_type":"TABLE"}"#).unwrap();
assert_eq!(legacy.valid, None);
}
#[test]
fn spatial_builder_reports_first_non_null_srid_per_column() {
let mut builder = SpatialColumnBuilder::new([3]);
@@ -23,6 +23,7 @@ fn prepare_schema_diff_function_signature() {
source_tables: vec![TableInfo {
name: "t".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -30,6 +31,7 @@ fn prepare_schema_diff_function_signature() {
target_tables: vec![TableInfo {
name: "t".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -122,6 +124,7 @@ fn schema_diff_preparation_field_names() {
source_tables: vec![TableInfo {
name: "t".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -129,6 +132,7 @@ fn schema_diff_preparation_field_names() {
target_tables: vec![TableInfo {
name: "t".to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -237,6 +241,7 @@ fn core_types_serialization_roundtrip() {
let table = TableInfo {
name: "users".to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: Some("user table".to_string()),
parent_schema: Some("public".to_string()),
parent_name: None,
@@ -245,6 +250,28 @@ fn core_types_serialization_roundtrip() {
let deserialized: TableInfo = serde_json::from_value(json).unwrap();
assert_eq!(table.name, deserialized.name);
assert_eq!(table.comment, deserialized.comment);
assert_eq!(deserialized.valid, None);
let valid_view: TableInfo = serde_json::from_value(serde_json::json!({
"name": "valid_view",
"table_type": "VIEW",
"valid": true,
"comment": null,
"parent_schema": null,
"parent_name": null
}))
.unwrap();
assert_eq!(valid_view.valid, Some(true));
let legacy_view: TableInfo = serde_json::from_value(serde_json::json!({
"name": "legacy_view",
"table_type": "VIEW",
"comment": null,
"parent_schema": null,
"parent_name": null
}))
.unwrap();
assert_eq!(legacy_view.valid, None);
}
/// ColumnInfo must serialize/deserialize consistently
@@ -6,6 +6,7 @@ fn table(name: &str) -> TableInfo {
TableInfo {
name: name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -9,6 +9,7 @@ fn table(name: &str) -> TableInfo {
TableInfo {
name: name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -13,6 +13,7 @@ fn table(name: &str) -> TableInfo {
TableInfo {
name: name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -18,6 +18,7 @@ fn generate_tables(count: usize, prefix: &str) -> Vec<TableInfo> {
.map(|i| TableInfo {
name: format!("{}_{}", prefix, i),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -261,6 +262,7 @@ fn benchmark_dependency_graph_build() {
.map(|i| TableInfo {
name: format!("tgt_{}", i),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -15,6 +15,7 @@ fn basic_table_info(name: &str) -> TableInfo {
TableInfo {
name: name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -7,6 +7,7 @@ fn table(name: &str) -> TableInfo {
TableInfo {
name: name.to_string(),
table_type: "BASE TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
@@ -8,6 +8,7 @@ fn table(name: &str) -> TableInfo {
TableInfo {
name: name.to_string(),
table_type: "TABLE".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,
+1
View File
@@ -1447,6 +1447,7 @@ impl DbxBackend for WebBackend {
Some(TableInfo {
name,
table_type: "COLLECTION".to_string(),
valid: None,
comment: None,
parent_schema: None,
parent_name: None,