feat(highgo): geometry/geography map preview via agent column_types

This commit is contained in:
t8y2 2026-06-13 10:25:12 +08:00
parent 71b61867e9
commit 2d1d40f6ab
3 changed files with 36 additions and 0 deletions

View File

@ -1142,6 +1142,40 @@ mod tests {
let _call_kv_method = AgentDriverClient::call_kv_method::<serde_json::Value>;
}
#[test]
fn agent_query_result_default_column_types_is_empty_vec() {
// Old agent JARs predate the column_types field. Rust tolerates the
// missing field via #[serde(default)] on db::QueryResult.column_types
// and consumers must see an empty vector rather than an error.
let json = serde_json::json!({
"columns": ["id", "name"],
"rows": [[1, "Ada"]],
"affected_rows": 0,
"execution_time_ms": 1
});
let result: crate::types::QueryResult = serde_json::from_value(json).expect("deserialize legacy agent result");
assert_eq!(result.columns, vec!["id".to_string(), "name".to_string()]);
assert!(result.column_types.is_empty(), "missing column_types must default to empty");
assert_eq!(result.rows.len(), 1);
}
#[test]
fn agent_query_result_passes_through_column_types_when_present() {
// New PostgresLike agents (HighGo / KingBase / Vastbase / openGauss /
// GaussDB) include column_types alongside columns so the desktop UI
// can detect geometry/geography columns and offer the map preview.
let json = serde_json::json!({
"columns": ["id", "geom"],
"column_types": ["int4", "geometry"],
"rows": [[1, "POINT(116.397 39.908)"]],
"affected_rows": 0,
"execution_time_ms": 5
});
let result: crate::types::QueryResult = serde_json::from_value(json).expect("deserialize agent result");
assert_eq!(result.column_types, vec!["int4".to_string(), "geometry".to_string()]);
assert_eq!(result.rows[0][1], serde_json::json!("POINT(116.397 39.908)"));
}
#[test]
fn builds_mongo_agent_request_params() {
assert_eq!(mongo_database_params("app"), serde_json::json!({ "database": "app" }));

View File

@ -79,6 +79,7 @@ DBX 只会在具备足够元数据和 SQL 生成能力的数据库上启用高
| ER 图 | MySQL、PostgreSQL、SQLite、SQL Server、Oracle、Redshift、DM、GaussDB、KWDB、KingBase、HighGo、Vastbase、GoldenDB、Access、H2、DB2、Teradata、Vertica、Firebird、Exasol、GBase、YashanDB |
| 数据库搜索 | MySQL、PostgreSQL、SQLite、SQL Server、Oracle、Redshift、DuckDB、ClickHouse、DM、GaussDB、KWDB、KingBase、HighGo、Vastbase、GoldenDB、Access、H2、Snowflake、Trino、Hive、DB2、Informix、Neo4j、Cassandra、BigQuery、Kylin、SunDB、TDengine、XuguDB、Databricks、Teradata、Vertica |
| 表数据导入 | MySQL、PostgreSQL、SQLite、DuckDB、ClickHouse、SQL Server、Oracle、Doris、StarRocks、Redshift、DM、GaussDB、KWDB、KingBase、HighGo、Vastbase、GoldenDB、Access、Databend |
| 几何字段地图预览 | PostgreSQL、HighGo、KingBase、Vastbase、openGauss、GaussDBPostGIS `geometry` / `geography` 列在结果集中以 WKT 显示,并提供网格工具栏的"地图预览"按钮) |
| 表结构编辑器 | MySQL、PostgreSQL、SQLite、SQL Server、KWDB |
| 创建数据库 | MySQL、PostgreSQL、SQL Server、ClickHouse、Oracle、DM、GaussDB、KWDB、Doris、StarRocks、Redshift、Teradata、Vertica |
| 字段血缘 | MySQL、PostgreSQL、SQLite、SQL Server、Oracle、Redshift、DM、GaussDB、KWDB |

View File

@ -79,6 +79,7 @@ DBX intentionally enables advanced workflows only where the app has enough metad
| ER diagram | MySQL, PostgreSQL, SQLite, SQL Server, Oracle, Redshift, DM, GaussDB, KWDB, KingBase, HighGo, Vastbase, GoldenDB, Access, H2, DB2, Teradata, Vertica, Firebird, Exasol, GBase, YashanDB |
| Database search | MySQL, PostgreSQL, SQLite, SQL Server, Oracle, Redshift, DuckDB, ClickHouse, DM, GaussDB, KWDB, KingBase, HighGo, Vastbase, GoldenDB, Access, H2, Snowflake, Trino, Hive, DB2, Informix, Neo4j, Cassandra, BigQuery, Kylin, SunDB, TDengine, XuguDB, Databricks, Teradata, Vertica |
| Table import | MySQL, PostgreSQL, SQLite, DuckDB, ClickHouse, SQL Server, Oracle, Doris, StarRocks, Redshift, DM, GaussDB, KWDB, KingBase, HighGo, Vastbase, GoldenDB, Access, Databend |
| Geometry map preview | PostgreSQL, HighGo, KingBase, Vastbase, openGauss, GaussDB (PostGIS `geometry` / `geography` columns are returned as WKT in the result grid and unlock the grid-toolbar map preview button) |
| Table structure editor | MySQL, PostgreSQL, SQLite, SQL Server, KWDB |
| Create database | MySQL, PostgreSQL, SQL Server, ClickHouse, Oracle, DM, GaussDB, KWDB, Doris, StarRocks, Redshift, Teradata, Vertica |
| Field lineage | MySQL, PostgreSQL, SQLite, SQL Server, Oracle, Redshift, DM, GaussDB, KWDB |