25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(kyuubi): add native connection support
zipg868502326c7d
diff --git a/agents/drivers/hive-go/connector.go b/agents/drivers/hive-go/connector.goindex c232d08df8..ce745c1827 100644--- a/agents/drivers/hive-go/connector.go+++ b/agents/drivers/hive-go/connector.go@@ -89,7 +89,7 @@ func newDiscoveryConnector(config connectionConfig) *discoveryConnector {BrowserResponsePort: config.BrowserResponsePort,BrowserResponseTimeout: config.BrowserResponseTimeout,BrowserDisableSSLCheck: config.BrowserDisableSSLCheck,- WaitForNonQueryCompletion: strings.EqualFold(config.DatabaseType, "impala"),+ WaitForNonQueryCompletion: waitsForNonQueryCompletion(config.DatabaseType),})},driver: &gohive.Driver{},@@ -98,6 +98,10 @@ func newDiscoveryConnector(config connectionConfig) *discoveryConnector {}}+func waitsForNonQueryCompletion(databaseType string) bool {+ return strings.EqualFold(databaseType, "impala") || strings.EqualFold(databaseType, "kyuubi")+}+func gssapiOptionsFromKerberos(config kerberosConfig) gosasl.GSSAPIOptions {return gosasl.GSSAPIOptions{ConfigPath: config.ConfigPath,diff --git a/agents/drivers/hive-go/connector_test.go b/agents/drivers/hive-go/connector_test.goindex 89a2d35310..af9678152a 100644--- a/agents/drivers/hive-go/connector_test.go+++ b/agents/drivers/hive-go/connector_test.go@@ -114,6 +114,15 @@ func TestNormalizeHiveAuth(t *testing.T) {}}+func TestWaitsForKyuubiAndImpalaNonQueryCompletion(t *testing.T) {+ if !waitsForNonQueryCompletion("kyuubi") || !waitsForNonQueryCompletion("KYUUBI") || !waitsForNonQueryCompletion("impala") {+ t.Fatal("Kyuubi and Impala must wait for asynchronous non-query operations")+ }+ if waitsForNonQueryCompletion("hive") {+ t.Fatal("Hive must retain its existing non-query behavior")+ }+}+func TestKerberosServiceForEndpoint(t *testing.T) {target := endpoint{Host: "hs2.example.com", Port: 10000, Principal: "hive/[email protected]"}discovered := connectionConfig{Kerberos: kerberosConfig{Service: "hive"}}diff --git a/agents/drivers/hive-go/main.go b/agents/drivers/hive-go/main.goindex 7ad269e491..6af04f087c 100644--- a/agents/drivers/hive-go/main.go+++ b/agents/drivers/hive-go/main.go@@ -431,7 +431,11 @@ func (server *server) dispatch(method string, params map[string]json.RawMessage)case "list_constraints", "list_partitions", "list_subpartitions":return []any{}, false, nilcase "get_object_source":- result, err := server.getTableDDL(stringParam(params, "schema"), firstNonEmpty(stringParam(params, "name"), stringParam(params, "table")))+ result, err := server.getObjectSource(+ stringParam(params, "schema"),+ firstNonEmpty(stringParam(params, "name"), stringParam(params, "table")),+ stringParam(params, "object_type"),+ )return result, false, errcase "get_table_ddl":result, err := server.getTableDDL(stringParam(params, "schema"), stringParam(params, "table"))diff --git a/agents/drivers/hive-go/metadata.go b/agents/drivers/hive-go/metadata.goindex 8fb1ff97a9..bc0dcf1c1b 100644--- a/agents/drivers/hive-go/metadata.go+++ b/agents/drivers/hive-go/metadata.go@@ -40,6 +40,13 @@ type objectInfo struct {Valid *bool `json:"valid,omitempty"`}+type objectSource struct {+ Name string `json:"name"`+ ObjectType string `json:"object_type"`+ Schema *string `json:"schema"`+ Source string `json:"source"`+}+type columnInfo struct {Name string `json:"name"`DataType string `json:"data_type"`@@ -200,7 +207,11 @@ func (server *server) connectionInfo() (map[string]any, error) {productName := "Apache Hive"compatibilityMode := "hive"driverName := "DBX Hive Go Agent"- if strings.EqualFold(server.params.DatabaseType, "impala") || strings.Contains(strings.ToLower(version), "impalad version") {+ if strings.EqualFold(server.params.DatabaseType, "kyuubi") {+ productName = "Apache Kyuubi"+ compatibilityMode = "kyuubi"+ driverName = "DBX Kyuubi Go Agent"+ } else if strings.EqualFold(server.params.DatabaseType, "impala") || strings.Contains(strings.ToLower(version), "impalad version") {productName = "Apache Impala"compatibilityMode = "impala"driverName = "DBX Impala Go Agent"@@ -573,6 +584,19 @@ func (server *server) getTableDDL(schema, table string) (string, error) {return strings.Join(lines, "\n") + "\n", nil}+func (server *server) getObjectSource(schema, name, objectType string) (objectSource, error) {+ source, err := server.getTableDDL(schema, name)+ if err != nil {+ return objectSource{}, err+ }+ return objectSource{+ Name: name,+ ObjectType: strings.ToUpper(objectType),+ Schema: optionalString(schema),+ Source: source,+ }, nil+}+func (server *server) getExplainInfo(sqlText string) (string, error) {sqlText = trimStatementSQL(sqlText)if sqlText == "" {diff --git a/agents/drivers/hive-go/metadata_test.go b/agents/drivers/hive-go/metadata_test.goindex c9bba860b9..a6c114de1c 100644--- a/agents/drivers/hive-go/metadata_test.go+++ b/agents/drivers/hive-go/metadata_test.go@@ -3,6 +3,7 @@ package mainimport ("context""database/sql/driver"+ "encoding/json""errors""reflect""strings"@@ -20,6 +21,77 @@ func TestShowTablesRowName(t *testing.T) {}}+func TestKyuubiConnectionInfoReportsNativeIdentity(t *testing.T) {+ behavior := &scriptedBehavior{+ query: func(ctx context.Context, query string) (driver.Rows, error) {+ switch query {+ case "SELECT VERSION()":+ return newScriptedRows(ctx, []string{"version"}, []string{"STRING"}, [][]driver.Value{{"3.5.8"}}), nil+ case "SELECT CURRENT_USER()":+ return newScriptedRows(ctx, []string{"current_user"}, []string{"STRING"}, [][]driver.Value{{"dbx"}}), nil+ default:+ return nil, errors.New("unexpected query: " + query)+ }+ },+ }+ server := newScriptedServer(t, behavior)+ server.params.DatabaseType = "kyuubi"+ server.config.Username = "fallback"++ info, err := server.connectionInfo()+ if err != nil {+ t.Fatal(err)+ }+ if info["compatibilityMode"] != "kyuubi" || info["username"] != "dbx" || info["version"] != "3.5.8" {+ t.Fatalf("unexpected Kyuubi connection info: %#v", info)+ }+ databaseInfo, ok := info["databaseInfo"].(map[string]string)+ if !ok || databaseInfo["productName"] != "Apache Kyuubi" || databaseInfo["driverName"] != "DBX Kyuubi Go Agent" {+ t.Fatalf("unexpected Kyuubi database identity: %#v", info["databaseInfo"])+ }+}++func TestGetObjectSourceReturnsProtocolObject(t *testing.T) {+ behavior := &scriptedBehavior{+ query: func(ctx context.Context, query string) (driver.Rows, error) {+ if query != "SHOW CREATE TABLE `dbx_kyuubi_demo`.`high_value_orders`" {+ t.Fatalf("unexpected query: %q", query)+ }+ return newScriptedRows(+ ctx,+ []string{"createtab_stmt"},+ []string{"STRING"},+ [][]driver.Value{+ {"CREATE VIEW dbx_kyuubi_demo.high_value_orders"},+ {"AS SELECT id, customer, amount FROM dbx_kyuubi_demo.orders WHERE amount >= 50"},+ },+ ), nil+ },+ }+ server := newScriptedServer(t, behavior)+ defer server.disconnect()++ result, _, err := server.dispatch("get_object_source", map[string]json.RawMessage{+ "schema": json.RawMessage(`"dbx_kyuubi_demo"`),+ "name": json.RawMessage(`"high_value_orders"`),+ "object_type": json.RawMessage(`"VIEW"`),+ })+ if err != nil {+ t.Fatal(err)+ }+ source, ok := result.(objectSource)+ if !ok {+ t.Fatalf("get_object_source returned %T instead of objectSource", result)+ }+ if source.Name != "high_value_orders" || source.ObjectType != "VIEW" || source.Schema == nil || *source.Schema != "dbx_kyuubi_demo" {+ t.Fatalf("unexpected object source metadata: %#v", source)+ }+ expected := "CREATE VIEW dbx_kyuubi_demo.high_value_orders\nAS SELECT id, customer, amount FROM dbx_kyuubi_demo.orders WHERE amount >= 50\n"+ if source.Source != expected {+ t.Fatalf("unexpected object source DDL: %q", source.Source)+ }+}+func TestListDatabasesUsesShowDatabasesBeforeHiveServerMetadata(t *testing.T) {behavior := &scriptedBehavior{query: func(ctx context.Context, sql string) (driver.Rows, error) {diff --git a/apps/desktop/public/icons/database/kyuubi.png b/apps/desktop/public/icons/database/kyuubi.pngnew file mode 100644index 0000000000..36c5b798c0Binary files /dev/null and b/apps/desktop/public/icons/database/kyuubi.png differdiff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vueindex 6bb617f370..1ff7ba37a3 100644--- a/apps/desktop/src/components/connection/ConnectionDialog.vue+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue@@ -1162,6 +1162,7 @@ const driverProfiles: Record<trino: { type: "trino", port: 8080, user: "", label: "Trino", icon: "trino" },prestosql: { type: "prestosql", port: 8080, user: "", label: "PrestoSQL", icon: "presto" },hive: { type: "hive", port: 10000, user: "", label: "Apache Hive", icon: "hive" },+ kyuubi: { type: "kyuubi", port: 10009, user: "", label: "Apache Kyuubi", icon: "kyuubi", urlParams: "auth=NONE" },impala: { type: "impala", port: 21050, user: "", label: "Apache Impala", icon: "impala", urlParams: "auth=noSasl" },spark: { type: "spark", port: 10015, user: "", label: "Apache Spark", icon: "spark" },db2: { type: "db2", port: 50000, user: "db2inst1", label: "IBM DB2", icon: "db2" },@@ -2416,7 +2417,7 @@ function applyProfile(val: string, preserveConnectionFields = false) {form.value.connection_string = undefined;form.value.url_params = "";}- resetHiveKerberosFields(profile.type === "hive" || profile.type === "impala" ? form.value : undefined);+ resetHiveKerberosFields(profile.type === "hive" || profile.type === "kyuubi" || profile.type === "impala" ? form.value : undefined);}}@@ -2542,7 +2543,7 @@ watch(resetVictoriaMetricsFields();}resetElasticsearchProxyFields(config.db_type === "elasticsearch" ? config.external_config : undefined);- resetHiveKerberosFields(config.db_type === "hive" || config.db_type === "impala" ? config : undefined);+ resetHiveKerberosFields(config.db_type === "hive" || config.db_type === "kyuubi" || config.db_type === "impala" ? config : undefined);resetDamengJvmOptions(config.db_type === "dameng" ? config : undefined);h2ConnectionMode.value = h2ConnectionModeForConfig(config);customColorInput.value = config.color || "";@@ -2797,6 +2798,7 @@ const iconTypeMap: Record<string, string> = {trino: "trino",prestosql: "prestosql",hive: "hive",+ kyuubi: "kyuubi",impala: "impala",spark: "spark",db2: "db2",@@ -2879,6 +2881,7 @@ const dbOptions: DbOption[] = [{ value: "trino", label: "Trino" },{ value: "prestosql", label: "PrestoSQL" },{ value: "hive", label: "Hive" },+ { value: "kyuubi", label: "Apache Kyuubi" },{ value: "impala", label: "Apache Impala" },{ value: "spark", label: "Apache Spark" },{ value: "db2", label: "DB2" },@@ -2925,7 +2928,7 @@ const dbCategoryDefinitions: Array<{{key: "analytics",titleKey: "connection.databaseCategoryAnalytics",- optionValues: ["cloudberry", "clickhouse", "doris", "starrocks", "databend", "selectdb", "databricks", "saphana", "teradata", "vertica", "exasol", "redshift", "snowflake", "trino", "prestosql", "hive", "impala", "spark", "bigquery", "kylin", "dremio"],+ optionValues: ["cloudberry", "clickhouse", "doris", "starrocks", "databend", "selectdb", "databricks", "saphana", "teradata", "vertica", "exasol", "redshift", "snowflake", "trino", "prestosql", "hive", "kyuubi", "impala", "spark", "bigquery", "kylin", "dremio"],},{key: "domestic",@@ -3767,7 +3770,7 @@ function connectionConfigForSubmit(id: string, generatedName = ""): ConnectionCoconfig.ssl = !!config.ssl || damengSsl.enabled;config.url_params = applyDamengSslUrlParams(config.url_params, config.ssl, damengSsl.sslFilesPath, damengSsl.sslKeystorePassword, damengSsl.sslProtocol);}- if (config.db_type === "hive" || config.db_type === "impala") {+ if (config.db_type === "hive" || config.db_type === "kyuubi" || config.db_type === "impala") {if (hiveAuthMode.value === "kerberos" && !hivePrincipal.value.trim()) {throw new Error(t("connection.hiveKerberosPrincipalRequired"));}@@ -7039,7 +7042,7 @@ function openExternalUrl(url: string) {<p class="col-span-3 text-xs text-muted-foreground">{{ t("connection.oracleTnsPathHint") }}</p></div>- <template v-if="form.db_type === 'hive' || form.db_type === 'impala'">+ <template v-if="form.db_type === 'hive' || form.db_type === 'kyuubi' || form.db_type === 'impala'"><div class="grid grid-cols-4 items-center gap-4"><Label :class="connectionLabelClass">{{ t("connection.hiveAuthMode") }}</Label><div class="col-span-3 grid h-8 grid-cols-2 overflow-hidden rounded-md border border-input bg-muted/30 p-0.5">diff --git a/apps/desktop/src/components/icons/DatabaseIcon.spec.ts b/apps/desktop/src/components/icons/DatabaseIcon.spec.tsindex acdc7eef84..512917a863 100644--- a/apps/desktop/src/components/icons/DatabaseIcon.spec.ts+++ b/apps/desktop/src/components/icons/DatabaseIcon.spec.ts@@ -44,6 +44,17 @@ describe("DatabaseIcon", () => {app.unmount();});+ it("uses the Apache Kyuubi asset instead of the Hive asset", async () => {+ const container = document.createElement("div");+ document.body.appendChild(container);+ const app = createApp(DatabaseIcon, { dbType: "kyuubi" });+ app.mount(container);+ await nextTick();++ expect(container.querySelector("img")?.getAttribute("src")).toBe("/icons/database/kyuubi.png");+ app.unmount();+ });+it("uses the Meilisearch asset", async () => {const container = document.createElement("div");document.body.appendChild(container);diff --git a/apps/desktop/src/components/icons/DatabaseIcon.vue b/apps/desktop/src/components/icons/DatabaseIcon.vueindex 4da59dd00a..62d0c6491c 100644--- a/apps/desktop/src/components/icons/DatabaseIcon.vue+++ b/apps/desktop/src/components/icons/DatabaseIcon.vue@@ -56,6 +56,7 @@ const assetIcons: Record<string, string> = {presto: "presto",prestosql: "presto",hive: "hive",+ kyuubi: "kyuubi.png",impala: "impala",hbase: "hbase",phoenix: "phoenix",diff --git a/apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.tsindex a63af01d92..a3899047b7 100644--- a/apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.ts+++ b/apps/desktop/src/lib/__tests__/connection/connectionAttemptTimeout.spec.ts@@ -22,6 +22,10 @@ describe("connectionAttemptTimeout", () => {expect(connectionAttemptTimeoutMs({ db_type: "impala", connect_timeout_secs: 5, transport_layers: [] })).toBe(AGENT_DRIVER_MIN_CONNECT_TIMEOUT_SECS * 1000 + CONNECTION_ATTEMPT_TIMEOUT_BUFFER_MS);});+ it("uses the startup floor for Kyuubi agent connections", () => {+ expect(connectionAttemptTimeoutMs({ db_type: "kyuubi", connect_timeout_secs: 5, transport_layers: [] })).toBe(AGENT_DRIVER_MIN_CONNECT_TIMEOUT_SECS * 1000 + CONNECTION_ATTEMPT_TIMEOUT_BUFFER_MS);+ });+it("uses the startup floor for generic JDBC plugin connections", () => {expect(connectionAttemptTimeoutMs({ db_type: "jdbc", connect_timeout_secs: 5, transport_layers: [] })).toBe(AGENT_DRIVER_MIN_CONNECT_TIMEOUT_SECS * 1000 + CONNECTION_ATTEMPT_TIMEOUT_BUFFER_MS);});diff --git a/apps/desktop/src/lib/__tests__/connection/connectionPassword.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionPassword.spec.tsindex 4cb6466787..42df5c7f56 100644--- a/apps/desktop/src/lib/__tests__/connection/connectionPassword.spec.ts+++ b/apps/desktop/src/lib/__tests__/connection/connectionPassword.spec.ts@@ -29,6 +29,17 @@ describe("connection password prompting", () => {expect(connectionNeedsPasswordPrompt(connection({ url_params: "auth=noSasl;principal=impala/[email protected]" }))).toBe(true);});+ it("allows Kyuubi NONE and NOSASL connections to persist an empty password", () => {+ expect(connectionNeedsPasswordPrompt(connection({ db_type: "kyuubi", port: 10009, url_params: "auth=NONE" }))).toBe(false);+ expect(connectionNeedsPasswordPrompt(connection({ db_type: "kyuubi", port: 10009, url_params: "auth=NOSASL" }))).toBe(false);+ expect(connectionNeedsPasswordPrompt(connection({ db_type: "kyuubi", port: 10009, url_params: "" }))).toBe(false);+ });++ it("prompts for Kyuubi authentication modes that require credentials", () => {+ expect(connectionNeedsPasswordPrompt(connection({ db_type: "kyuubi", port: 10009, url_params: "auth=LDAP" }))).toBe(true);+ expect(connectionNeedsPasswordPrompt(connection({ db_type: "kyuubi", port: 10009, url_params: "principal=hive/[email protected]" }))).toBe(true);+ });+it("does not change password prompting for other database types", () => {expect(connectionNeedsPasswordPrompt(connection({ db_type: "mysql", port: 3306, url_params: "auth=noSasl" }))).toBe(true);expect(connectionNeedsPasswordPrompt(connection({ db_type: "postgres", port: 5432, save_password: true }))).toBe(false);diff --git a/apps/desktop/src/lib/__tests__/table/tableSelectSql.spec.ts b/apps/desktop/src/lib/__tests__/table/tableSelectSql.spec.tsindex b56d08881a..7a59d1cdcc 100644--- a/apps/desktop/src/lib/__tests__/table/tableSelectSql.spec.ts+++ b/apps/desktop/src/lib/__tests__/table/tableSelectSql.spec.ts@@ -50,6 +50,10 @@ describe("quoteTableIdentifier", () => {expect(quoteTableIdentifier("mysql", "orders")).toBe("`orders`");});+ it("backtick-quotes Kyuubi identifiers", () => {+ expect(quoteTableIdentifier("kyuubi", "order`items")).toBe("`order``items`");+ });+it("uses BigQuery quoted identifiers and escape sequences", () => {expect(quoteTableIdentifier("bigquery", "order")).toBe("`order`");expect(quoteTableIdentifier("bigquery", "a`b")).toBe("`a\\`b`");diff --git a/apps/desktop/src/lib/connection/__tests__/agentDriverInstallHint.spec.ts b/apps/desktop/src/lib/connection/__tests__/agentDriverInstallHint.spec.tsindex 3db264339f..29d19b68ed 100644--- a/apps/desktop/src/lib/connection/__tests__/agentDriverInstallHint.spec.ts+++ b/apps/desktop/src/lib/connection/__tests__/agentDriverInstallHint.spec.ts@@ -9,10 +9,12 @@ describe("DuckDB driver installation", () => {});});-describe("Impala driver installation", () => {+describe("HiveServer2-compatible driver installation", () => {it("reuses the downloadable Hive driver", () => {expect(agentDriverInstallKey("impala")).toBe("hive");expect(showAgentDriverInstallHint("impala", [{ db_type: "hive", installed: true }])).toBe(false);+ expect(agentDriverInstallKey("kyuubi")).toBe("hive");+ expect(showAgentDriverInstallHint("kyuubi", [{ db_type: "hive", installed: true }])).toBe(false);});});diff --git a/apps/desktop/src/lib/connection/agentDriverInstallHint.ts b/apps/desktop/src/lib/connection/agentDriverInstallHint.tsindex 7cd1f67506..3b4e95cdc1 100644--- a/apps/desktop/src/lib/connection/agentDriverInstallHint.ts+++ b/apps/desktop/src/lib/connection/agentDriverInstallHint.ts@@ -24,7 +24,7 @@ export function hasInstalledAgentVersion(drivers: readonly AgentDriverInstallSta}export function agentDriverInstallKey(dbType: DatabaseType | undefined, driverProfile?: string): string | undefined {- if (dbType === "impala") return "hive";+ if (dbType === "kyuubi" || dbType === "impala") return "hive";if (dbType === "oracle") return "oracle";if (dbType === "mongodb") return "mongodb";if (dbType === "dameng") return "dameng";diff --git a/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts b/apps/desktop/src/lib/connection/connectionAttemptTimeout.tsindex d27d383be4..1696b5fd29 100644--- a/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts+++ b/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts@@ -30,6 +30,7 @@ const DRIVER_STARTUP_FLOOR_TYPES = new Set<DatabaseType>(["prestosql","jdbc","hive",+ "kyuubi","impala","spark","db2",diff --git a/apps/desktop/src/lib/connection/connectionPassword.ts b/apps/desktop/src/lib/connection/connectionPassword.tsindex 4b51aa4b78..cccd086dd5 100644--- a/apps/desktop/src/lib/connection/connectionPassword.ts+++ b/apps/desktop/src/lib/connection/connectionPassword.ts@@ -17,12 +17,14 @@ function hiveServerUrlParams(urlParams?: string): Map<string, string> {export function connectionUsesPasswordlessAuthentication(config: PasswordAuthenticationConfig): boolean {const profile = config.driver_profile || config.db_type;- if (config.db_type !== "impala" && profile !== "impala") return false;+ const isImpala = config.db_type === "impala" || profile === "impala";+ const isKyuubi = config.db_type === "kyuubi" || profile === "kyuubi";+ if (!isImpala && !isKyuubi) return false;const params = hiveServerUrlParams(config.url_params);if (params.get("principal")) return false;- const auth = (params.get("auth") || "nosasl").toLowerCase();- return auth === "nosasl";+ const auth = (params.get("auth") || (isKyuubi ? "none" : "nosasl")).toLowerCase();+ return isKyuubi ? auth === "none" || auth === "nosasl" : auth === "nosasl";}export function connectionNeedsPasswordPrompt(config: ConnectionConfig): boolean {diff --git a/apps/desktop/src/lib/database/__tests__/transferObjectKinds.spec.ts b/apps/desktop/src/lib/database/__tests__/transferObjectKinds.spec.tsindex 6e5dbda93f..3b1b5404d4 100644--- a/apps/desktop/src/lib/database/__tests__/transferObjectKinds.spec.ts+++ b/apps/desktop/src/lib/database/__tests__/transferObjectKinds.spec.ts@@ -4,7 +4,7 @@ import { manifestDatabaseTypes } from "@/lib/database/databaseDriverManifest";import { supportsTransfer } from "@/lib/database/databaseFeatureSupport";import type { DatabaseType } from "@/types/database";-const TABLE_ONLY_TRANSFER_DATABASES: DatabaseType[] = ["sqlite", "rqlite", "cloudflare-d1", "duckdb", "clickhouse", "mongodb", "questdb", "hive", "impala", "spark"];+const TABLE_ONLY_TRANSFER_DATABASES: DatabaseType[] = ["sqlite", "rqlite", "cloudflare-d1", "duckdb", "clickhouse", "mongodb", "questdb", "hive", "kyuubi", "impala", "spark"];describe("transferObjectKinds", () => {it("groups databases into transfer families", () => {diff --git a/apps/desktop/src/lib/database/databaseCapabilitySets.ts b/apps/desktop/src/lib/database/databaseCapabilitySets.tsindex 865f15bb32..a0da6d6a39 100644--- a/apps/desktop/src/lib/database/databaseCapabilitySets.ts+++ b/apps/desktop/src/lib/database/databaseCapabilitySets.ts@@ -27,6 +27,7 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>(["trino","prestosql","hive",+ "kyuubi","impala","spark","databend",diff --git a/apps/desktop/src/lib/database/databaseNamespaceCreation.ts b/apps/desktop/src/lib/database/databaseNamespaceCreation.tsindex 3c6543522a..107d666857 100644--- a/apps/desktop/src/lib/database/databaseNamespaceCreation.ts+++ b/apps/desktop/src/lib/database/databaseNamespaceCreation.ts@@ -66,6 +66,7 @@ export const DATABASE_NAMESPACE_CREATION_MATRIX = {trino: { database: "schema" },prestosql: { database: "schema" },hive: { deferred: "Hive database creation needs agent metadata validation first" },+ kyuubi: { deferred: "Kyuubi database creation needs dedicated metadata validation first" },impala: { deferred: "Impala database creation needs dedicated metadata validation first" },spark: { deferred: "Spark database creation needs agent metadata validation first" },db2: { database: "schema" },diff --git a/apps/desktop/src/lib/database/databaseObjectCapabilities.ts b/apps/desktop/src/lib/database/databaseObjectCapabilities.tsindex f6ddc4b149..935769e93b 100644--- a/apps/desktop/src/lib/database/databaseObjectCapabilities.ts+++ b/apps/desktop/src/lib/database/databaseObjectCapabilities.ts@@ -69,6 +69,7 @@ const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([["doris", TABLE_VIEW_OBJECTS],["starrocks", TABLE_VIEW_MV_OBJECTS],["hive", TABLE_VIEW_OBJECTS],+ ["kyuubi", TABLE_VIEW_OBJECTS],["impala", TABLE_VIEW_OBJECTS],["spark", TABLE_VIEW_OBJECTS],["trino", TABLE_VIEW_OBJECTS],diff --git a/apps/desktop/src/lib/database/databasePropertyEditing.ts b/apps/desktop/src/lib/database/databasePropertyEditing.tsindex 8b212efe2b..9d737b12e8 100644--- a/apps/desktop/src/lib/database/databasePropertyEditing.ts+++ b/apps/desktop/src/lib/database/databasePropertyEditing.ts@@ -66,6 +66,7 @@ export const DATABASE_PROPERTY_EDITING_MATRIX = {trino: { deferred: "catalog properties are connector-managed" },prestosql: { deferred: "catalog properties are connector-managed" },hive: { deferred: "database properties need agent metadata validation first" },+ kyuubi: { deferred: "database properties need Kyuubi-specific validation first" },impala: { deferred: "database properties need Impala-specific validation first" },spark: { deferred: "database properties need agent metadata validation first" },db2: { deferred: "schema properties need product-specific handling" },diff --git a/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts b/apps/desktop/src/lib/database/databaseTableDataCapabilities.tsindex 233fe9062d..e8db6baeb2 100644--- a/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts+++ b/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts@@ -90,6 +90,17 @@ const NAVICAT_STYLE_TABLE_DATA_TYPES = new Set<DatabaseType>([]);const DATABASE_CAPABILITY_OVERRIDES: Partial<Record<DatabaseType, Partial<DatabaseCapability>>> = {+ kyuubi: {+ tableData: {+ insert: false,+ updateRequiresPrimaryKey: false,+ deleteRequiresPrimaryKey: false,+ requiresTransactionalTableForExistingRows: false,+ existingRowsReadonly: true,+ transaction: false,+ readonly: true,+ },+ },impala: {tableData: {insert: false,diff --git a/apps/desktop/src/lib/database/jdbcDialect.ts b/apps/desktop/src/lib/database/jdbcDialect.tsindex 4d1c4ea29b..f67e283bfb 100644--- a/apps/desktop/src/lib/database/jdbcDialect.ts+++ b/apps/desktop/src/lib/database/jdbcDialect.ts@@ -13,7 +13,7 @@ const GAUSSDB_TARGET_SERVER_TYPE_KEY = "gaussdbTargetServerType";export const GAUSSDB_M_JDBC_DRIVER_PROFILE = "gaussdb-m";export const GAUSSDB_M_JDBC_DRIVER_CLASS = "com.huawei.gaussdb.jdbc.Driver";-const DATABASE_AS_EXECUTION_SCHEMA_TYPES = new Set<DatabaseType>(["hive", "impala", "spark"]);+const DATABASE_AS_EXECUTION_SCHEMA_TYPES = new Set<DatabaseType>(["hive", "kyuubi", "impala", "spark"]);const CONNECTION_ROOT_SCHEMA_TYPES = new Set<DatabaseType>(["oracle", "dameng", "oceanbase-oracle"]);const JDBC_DIALECT_MATCHERS: Array<{ type: DatabaseType; patterns: RegExp[] }> = [diff --git a/apps/desktop/src/lib/table/tableSelectSql.ts b/apps/desktop/src/lib/table/tableSelectSql.tsindex c4fe8c525d..988f43ffe3 100644--- a/apps/desktop/src/lib/table/tableSelectSql.ts+++ b/apps/desktop/src/lib/table/tableSelectSql.ts@@ -33,7 +33,19 @@ export function quoteTableIdentifier(databaseType: DatabaseType | undefined, nam// (DatabaseMetaData.getIdentifierQuoteString()) — pass through unquoted.if (databaseType === "jdbc") return name;if (databaseType === "bigquery") return `\`${name.replace(/`/g, "\\`")}\``;- if (databaseType === "mysql" || databaseType === "clickhouse" || databaseType === "hive" || databaseType === "impala" || databaseType === "spark" || databaseType === "databend" || databaseType === "tdengine" || databaseType === "access" || databaseType === "doris" || databaseType === "starrocks")+ if (+ databaseType === "mysql" ||+ databaseType === "clickhouse" ||+ databaseType === "hive" ||+ databaseType === "kyuubi" ||+ databaseType === "impala" ||+ databaseType === "spark" ||+ databaseType === "databend" ||+ databaseType === "tdengine" ||+ databaseType === "access" ||+ databaseType === "doris" ||+ databaseType === "starrocks"+ )return `\`${name.replace(/`/g, "``")}\``;if (databaseType === "informix" && /^[A-Za-z_][A-Za-z0-9_$]*$/.test(name)) return name;if (databaseType === "neo4j") return quoteCypherIdentifier(name);diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.tsindex 042436edf0..da1e3a46e6 100644--- a/apps/desktop/src/stores/connectionStore.ts+++ b/apps/desktop/src/stores/connectionStore.ts@@ -1095,6 +1095,7 @@ export const useConnectionStore = defineStore("connection", () => {trino: "Trino",prestosql: "PrestoSQL",hive: "Hive",+ kyuubi: "Apache Kyuubi",impala: "Apache Impala",spark: "Apache Spark",db2: "DB2",diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.tsindex e81560a87b..47457cfc76 100644--- a/apps/desktop/src/types/database.ts+++ b/apps/desktop/src/types/database.ts@@ -53,6 +53,7 @@ export type DatabaseType =| "trino"| "prestosql"| "hive"+ | "kyuubi"| "impala"| "spark"| "db2"diff --git a/crates/dbx-core/assets/database-drivers.manifest.json b/crates/dbx-core/assets/database-drivers.manifest.jsonindex 87b707b93d..48cd627ef8 100644--- a/crates/dbx-core/assets/database-drivers.manifest.json+++ b/crates/dbx-core/assets/database-drivers.manifest.json@@ -1460,6 +1460,36 @@"driverManagement": true}},+ {+ "dbType": "kyuubi",+ "label": "Apache Kyuubi",+ "runtimeMode": "agent",+ "mcpMode": "bridge",+ "agentKey": "hive",+ "singleConnectionPool": false,+ "metadataConnectionScoped": false,+ "skipTcpProbe": true,+ "defaultPort": 10009,+ "supportLevel": "operate",+ "capabilities": {+ "queryExecution": true,+ "metadataBrowse": true,+ "objectBrowser": true,+ "objectSource": true,+ "schemaSearch": true,+ "diagram": false,+ "tableDataEdit": false,+ "tableStructureEdit": false,+ "tableImport": false,+ "dataTransfer": true,+ "sqlFileExecution": true,+ "databaseCreate": false,+ "fieldLineage": false,+ "sqlExplain": true,+ "userAdmin": false,+ "driverManagement": true+ }+ },{"dbType": "impala","label": "Apache Impala",diff --git a/crates/dbx-core/src/agent_catalog.rs b/crates/dbx-core/src/agent_catalog.rsindex 6ecef5f7d4..001da03ec3 100644--- a/crates/dbx-core/src/agent_catalog.rs+++ b/crates/dbx-core/src/agent_catalog.rs@@ -196,6 +196,13 @@ const AGENT_CATALOG: &[AgentCatalogEntry] = &[store_visible: true,profiles: &[],},+ AgentCatalogEntry {+ db_type: DatabaseType::Kyuubi,+ key: "hive",+ label: "Apache Kyuubi",+ store_visible: false,+ profiles: &[],+ },AgentCatalogEntry {db_type: DatabaseType::Impala,key: "hive",@@ -410,4 +417,10 @@ mod tests {assert_eq!(agent_key(&DatabaseType::Impala, None), Some("hive"));assert_eq!(driver_store_entries().filter(|(key, _)| *key == "hive").count(), 1);}++ #[test]+ fn kyuubi_reuses_hive_agent_without_duplicate_store_entry() {+ assert_eq!(agent_key(&DatabaseType::Kyuubi, None), Some("hive"));+ assert_eq!(driver_store_entries().filter(|(key, _)| *key == "hive").count(), 1);+ }}diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rsindex 35745c5a59..abdd6ad7cd 100644--- a/crates/dbx-core/src/connection.rs+++ b/crates/dbx-core/src/connection.rs@@ -172,6 +172,7 @@ macro_rules! agent_connection_pool_database_type {| DatabaseType::Snowflake| DatabaseType::Trino| DatabaseType::Hive+ | DatabaseType::Kyuubi| DatabaseType::Impala| DatabaseType::Spark| DatabaseType::Db2diff --git a/crates/dbx-core/src/db_admin_sql.rs b/crates/dbx-core/src/db_admin_sql.rsindex 72d34d0284..053fbaeb85 100644--- a/crates/dbx-core/src/db_admin_sql.rs+++ b/crates/dbx-core/src/db_admin_sql.rs@@ -489,7 +489,13 @@ pub fn build_empty_table_sql(options: TableAdminSqlOptions) -> String {match options.database_type {Some(DatabaseType::ClickHouse) => format!("ALTER TABLE {table} DELETE WHERE 1 = 1;"),Some(DatabaseType::Bigquery) => format!("DELETE FROM {table} WHERE TRUE;"),- Some(DatabaseType::Cassandra | DatabaseType::Hive | DatabaseType::Kylin | DatabaseType::Questdb) => {+ Some(+ DatabaseType::Cassandra+ | DatabaseType::Hive+ | DatabaseType::Kyuubi+ | DatabaseType::Kylin+ | DatabaseType::Questdb,+ ) => {format!("TRUNCATE TABLE {table};")}Some(DatabaseType::Iotdb) => format!("DELETE FROM {};", iotdb_timeseries_pattern(&table)),@@ -645,19 +651,20 @@ pub fn build_duplicate_table_structure_sql(options: DuplicateTableStructureSqlOplet source = qualified_name(options.database_type, options.schema.as_deref(), &options.source_name);let target =qualified_duplicate_target_name(options.database_type, options.schema.as_deref(), &options.target_name);- let structure_sql = if matches!(options.database_type, Some(DatabaseType::Mysql | DatabaseType::Impala)) {- format!("CREATE TABLE {target} LIKE {source};")- } else if options.database_type == Some(DatabaseType::Questdb) {- format!("CREATE TABLE {target} (LIKE {source});")- } else if options.database_type.is_some_and(is_postgres_like_structure_copy) {- format!("CREATE TABLE {target} (LIKE {source} INCLUDING ALL);")- } else if options.database_type == Some(DatabaseType::SqlServer) {- format!("SELECT TOP 0 * INTO {target} FROM {source};")- } else if options.database_type.is_some_and(uses_false_predicate_duplicate_structure) {- format!("CREATE TABLE {target} AS SELECT * FROM {source} WHERE 1=0")- } else {- format!("CREATE TABLE {target} AS SELECT * FROM {source} WHERE 0;")- };+ let structure_sql =+ if matches!(options.database_type, Some(DatabaseType::Mysql | DatabaseType::Kyuubi | DatabaseType::Impala)) {+ format!("CREATE TABLE {target} LIKE {source};")+ } else if options.database_type == Some(DatabaseType::Questdb) {+ format!("CREATE TABLE {target} (LIKE {source});")+ } else if options.database_type.is_some_and(is_postgres_like_structure_copy) {+ format!("CREATE TABLE {target} (LIKE {source} INCLUDING ALL);")+ } else if options.database_type == Some(DatabaseType::SqlServer) {+ format!("SELECT TOP 0 * INTO {target} FROM {source};")+ } else if options.database_type.is_some_and(uses_false_predicate_duplicate_structure) {+ format!("CREATE TABLE {target} AS SELECT * FROM {source} WHERE 1=0")+ } else {+ format!("CREATE TABLE {target} AS SELECT * FROM {source} WHERE 0;")+ };let mut comment_sql = Vec::new();if let Some(database_type) =@@ -1695,6 +1702,17 @@ mod tests {}),"CREATE TABLE `dbx_demo`.`connection_test_copy` LIKE `dbx_demo`.`connection_test`;");+ assert_eq!(+ build_duplicate_table_structure_sql(DuplicateTableStructureSqlOptions {+ database_type: Some(DatabaseType::Kyuubi),+ schema: Some("dbx_demo".to_string()),+ source_name: "orders".to_string(),+ target_name: "orders_copy".to_string(),+ table_comment: None,+ column_comments: vec![],+ }),+ "CREATE TABLE `dbx_demo`.`orders_copy` LIKE `dbx_demo`.`orders`;"+ );assert_eq!(build_duplicate_table_structure_sql(DuplicateTableStructureSqlOptions {database_type: Some(DatabaseType::Postgres),diff --git a/crates/dbx-core/src/models/connection.rs b/crates/dbx-core/src/models/connection.rsindex 8c2514e857..bb596aa009 100644--- a/crates/dbx-core/src/models/connection.rs+++ b/crates/dbx-core/src/models/connection.rs@@ -564,6 +564,7 @@ pub enum DatabaseType {#[serde(rename = "prestosql")]PrestoSql,Hive,+ Kyuubi,Impala,Spark,#[serde(rename = "db2")]@@ -1142,6 +1143,7 @@ impl ConnectionConfig {DatabaseType::Trino => format!("trino://{host}:{port}{db_part}"),DatabaseType::PrestoSql => format!("prestosql://{host}:{port}{db_part}"),DatabaseType::Hive => format!("hive://{host}:{port}{db_part}"),+ DatabaseType::Kyuubi => format!("kyuubi://{host}:{port}{db_part}"),DatabaseType::Impala => format!("impala://{host}:{port}{db_part}"),DatabaseType::Spark => format!("spark://{host}:{port}{db_part}"),DatabaseType::Db2 => format!("db2://{host}:{port}{db_part}"),@@ -1353,6 +1355,15 @@ impl ConnectionConfig {DatabaseType::Hive => {format!("hive://{}:{}@{host}:{port}{db_part}", username, password)}+ DatabaseType::Kyuubi => {+ if self.username.is_empty() && self.password.is_empty() {+ format!("kyuubi://{host}:{port}{db_part}")+ } else if self.password.is_empty() {+ format!("kyuubi://{}@{host}:{port}{db_part}", username)+ } else {+ format!("kyuubi://{}:{}@{host}:{port}{db_part}", username, password)+ }+ }DatabaseType::Impala => {if self.username.is_empty() && self.password.is_empty() {format!("impala://{host}:{port}{db_part}")@@ -2627,6 +2638,28 @@ mod tests {);}+ #[test]+ fn kyuubi_database_type_and_connection_urls_are_stable() {+ assert_eq!(serde_json::to_string(&DatabaseType::Kyuubi).unwrap(), "\"kyuubi\"");+ assert_eq!(serde_json::from_str::<DatabaseType>("\"kyuubi\"").unwrap(), DatabaseType::Kyuubi);++ let mut config = mysql_config("dbx", "", Some("analytics"));+ config.db_type = DatabaseType::Kyuubi;+ config.host = "kyuubi.local".to_string();+ config.port = 10009;+ assert_eq!(config.connection_url(), "kyuubi://[email protected]:10009/analytics");++ config.username.clear();+ assert_eq!(config.connection_url(), "kyuubi://kyuubi.local:10009/analytics");++ config.username = "dbx".to_string();+ config.password = "secret".to_string();+ assert_eq!(+ config.connection_url_with_host(&config.host, config.port),+ "kyuubi://dbx:[email protected]:10009/analytics"+ );+ }+#[test]fn cloudflare_d1_database_type_and_api_url_are_stable() {assert_eq!(serde_json::to_string(&DatabaseType::CloudflareD1).unwrap(), "\"cloudflare-d1\"");diff --git a/crates/dbx-core/src/sql_dialect/capabilities.rs b/crates/dbx-core/src/sql_dialect/capabilities.rsindex 022b08b6ea..dc4cebebc6 100644--- a/crates/dbx-core/src/sql_dialect/capabilities.rs+++ b/crates/dbx-core/src/sql_dialect/capabilities.rs@@ -53,6 +53,7 @@ pub fn is_schema_aware(database_type: DatabaseType) -> bool {| DatabaseType::Trino| DatabaseType::PrestoSql| DatabaseType::Hive+ | DatabaseType::Kyuubi| DatabaseType::Impala| DatabaseType::Spark| DatabaseType::Db2diff --git a/crates/dbx-core/src/sql_dialect/ddl_profile.rs b/crates/dbx-core/src/sql_dialect/ddl_profile.rsindex 87bf208955..7fcffd046b 100644--- a/crates/dbx-core/src/sql_dialect/ddl_profile.rs+++ b/crates/dbx-core/src/sql_dialect/ddl_profile.rs@@ -669,8 +669,10 @@ pub fn profile_for(db_type: DatabaseType) -> DdlDialectProfile {ClickHouse => clickhouse_profile(),- DuckDb | Questdb | SapHana | Teradata | Snowflake | Trino | PrestoSql | Hive | Impala | Spark | Db2- | Informix | Bigquery | Kylin | Oscar | Tdengine | Iotdb | Databricks | Jdbc => conservative_ansi(db_type),+ DuckDb | Questdb | SapHana | Teradata | Snowflake | Trino | PrestoSql | Hive | Kyuubi | Impala | Spark+ | Db2 | Informix | Bigquery | Kylin | Oscar | Tdengine | Iotdb | Databricks | Jdbc => {+ conservative_ansi(db_type)+ }// Non-tabular / not applicable for relational CREATE TABLERedis | MongoDb | Elasticsearch | Easysearch | Meilisearch | Qdrant | Milvus | Weaviate | ChromaDb | Neo4jdiff --git a/crates/dbx-core/src/sql_dialect/identifiers.rs b/crates/dbx-core/src/sql_dialect/identifiers.rsindex b95ee9e4ae..6ed24beb31 100644--- a/crates/dbx-core/src/sql_dialect/identifiers.rs+++ b/crates/dbx-core/src/sql_dialect/identifiers.rs@@ -129,6 +129,7 @@ pub fn quote_table_identifier(database_type: Option<DatabaseType>, name: &str) -| DatabaseType::StarRocks| DatabaseType::ManticoreSearch| DatabaseType::Hive+ | DatabaseType::Kyuubi| DatabaseType::Impala| DatabaseType::Spark| DatabaseType::Databend@@ -379,6 +380,7 @@ pub(crate) fn quote_transfer_identifier(name: &str, database_type: &DatabaseType| DatabaseType::Doris| DatabaseType::StarRocks| DatabaseType::Hive+ | DatabaseType::Kyuubi| DatabaseType::Impala| DatabaseType::Spark| DatabaseType::Questdb => format!("`{}`", name.replace('`', "``")),diff --git a/crates/dbx-core/src/sql_dialect/table_select.rs b/crates/dbx-core/src/sql_dialect/table_select.rsindex cde2ed9e1f..5070f5141f 100644--- a/crates/dbx-core/src/sql_dialect/table_select.rs+++ b/crates/dbx-core/src/sql_dialect/table_select.rs@@ -529,7 +529,7 @@ pub(super) fn build_select_columns(.collect::<Vec<_>>().join(", ");}- if !matches!(database_type, Some(DatabaseType::Hive | DatabaseType::Impala)) {+ if !matches!(database_type, Some(DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala)) {return "*".to_string();}columnsdiff --git a/crates/dbx-core/src/table_import.rs b/crates/dbx-core/src/table_import.rsindex 367fe79c7a..13ff2aaf77 100644--- a/crates/dbx-core/src/table_import.rs+++ b/crates/dbx-core/src/table_import.rs@@ -3550,7 +3550,11 @@ fn text_data_type(db_type: &DatabaseType) -> &'static str {DatabaseType::SqlServer => "NVARCHAR(MAX)",DatabaseType::Oracle | DatabaseType::OceanbaseOracle | DatabaseType::Dameng => "CLOB",DatabaseType::ClickHouse => "String",- DatabaseType::Hive | DatabaseType::Trino | DatabaseType::PrestoSql | DatabaseType::Databricks => "STRING",+ DatabaseType::Hive+ | DatabaseType::Kyuubi+ | DatabaseType::Trino+ | DatabaseType::PrestoSql+ | DatabaseType::Databricks => "STRING",_ => "TEXT",}}diff --git a/crates/dbx-core/src/transfer.rs b/crates/dbx-core/src/transfer.rsindex 0d0a61b812..4b2193553f 100644--- a/crates/dbx-core/src/transfer.rs+++ b/crates/dbx-core/src/transfer.rs@@ -2655,7 +2655,7 @@ pub fn map_column_type(source_type: &str, _source_db: &DatabaseType, target_db:// Extract basic type, `bigint unsigned` -> `bigint`base = base.split(' ').next().unwrap_or(base).trim();- if matches!(target_db, DatabaseType::Hive | DatabaseType::Impala) {+ if matches!(target_db, DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala) {return match base {"tinyint" => "TINYINT".into(),"smallint" | "int2" => "SMALLINT".into(),@@ -2859,7 +2859,8 @@ pub fn generate_create_table_ddl(line.push(' ');line.push_str(&default_clause);}- if !c.is_nullable && !matches!(target_db, DatabaseType::Hive | DatabaseType::Impala) {+ if !c.is_nullable && !matches!(target_db, DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala)+ {line.push_str(" NOT NULL");}if is_mysql_family {@@ -2882,7 +2883,7 @@ pub fn generate_create_table_ddl(}let mut pks = Vec::with_capacity(columns.iter().filter(|c| c.is_primary_key).count());- if !matches!(target_db, DatabaseType::Hive | DatabaseType::Impala) {+ if !matches!(target_db, DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala) {for c in columns {if c.is_primary_key {let qname = quote_identifier(&c.name, target_db);@@ -3320,7 +3321,7 @@ fn generate_upsert_typed_for_transfer(fn max_transfer_write_rows(db_type: &DatabaseType, mode: &TransferMode) -> usize {match (db_type, mode) {(DatabaseType::SqlServer, TransferMode::Append | TransferMode::Overwrite) => MAX_SQLSERVER_INSERT_ROWS,- (DatabaseType::Hive | DatabaseType::Impala, _) => 500,+ (DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala, _) => 500,(DatabaseType::Oracle, TransferMode::Append | TransferMode::Overwrite) => MAX_ORACLE_INSERT_ALL_ROWS,(DatabaseType::Oracle, TransferMode::Upsert) => MAX_ORACLE_MERGE_ROWS,_ => usize::MAX,@@ -6331,7 +6332,7 @@ where}#[derive(Default)]-struct ImpalaTransferCursor {+struct HiveServerTransferCursor {started: bool,session_id: Option<String>,}@@ -6348,13 +6349,13 @@ fn transfer_cursor_sql(format!("SELECT {col_list} FROM {full_table}")}-async fn fetch_impala_transfer_batch(+async fn fetch_hive_server_transfer_batch(state: &AppState,pool_key: &str,request: &TransferRequest,sql: &str,batch_size: usize,- cursor: &mut ImpalaTransferCursor,+ cursor: &mut HiveServerTransferCursor,) -> Result<db::QueryResult, String> {let query_timeout_secs = if cursor.started {0@@ -6400,7 +6401,7 @@ async fn fetch_impala_transfer_batch(Ok(result)}-async fn close_impala_transfer_cursor(state: &AppState, pool_key: &str, cursor: &mut ImpalaTransferCursor) {+async fn close_hive_server_transfer_cursor(state: &AppState, pool_key: &str, cursor: &mut HiveServerTransferCursor) {let Some(session_id) = cursor.session_id.take() else {return;};@@ -6776,7 +6777,10 @@ where}let target_columns = if (request.mode == TransferMode::Upsert- && !matches!(target_db_type, DatabaseType::ClickHouse | DatabaseType::Hive | DatabaseType::Impala))+ && !matches!(+ target_db_type,+ DatabaseType::ClickHouse | DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala+ ))|| matches!(target_db_type, DatabaseType::Postgres | DatabaseType::Dameng){get_columns_for_transfer(@@ -6796,7 +6800,10 @@ where// Determine effective mode and PK columns for upsertlet (effective_mode, pk_columns) = if request.mode == TransferMode::Upsert {- if matches!(target_db_type, DatabaseType::ClickHouse | DatabaseType::Hive | DatabaseType::Impala) {+ if matches!(+ target_db_type,+ DatabaseType::ClickHouse | DatabaseType::Hive | DatabaseType::Kyuubi | DatabaseType::Impala+ ) {log::warn!("[transfer] upsert not supported for {:?}, falling back to append", target_db_type);(TransferMode::Append, vec![])} else {@@ -6823,10 +6830,10 @@ wherelet batch_size = if request.batch_size == 0 { 1000 } else { request.batch_size };let mut offset: u64 = 0;let mut total_transferred: u64 = 0;- // A single Agent cursor keeps Impala rows in one query execution. Re-running- // LIMIT/OFFSET pages cannot be made stable for tables without a unique key.- let use_impala_cursor = matches!(source_db_type, DatabaseType::Impala);- let impala_transfer_sql = use_impala_cursor.then(|| {+ // A single Agent cursor keeps Kyuubi/Impala rows in one query execution.+ // Re-running LIMIT/OFFSET pages is unstable for tables without a unique key.+ let use_hive_server_cursor = matches!(source_db_type, DatabaseType::Kyuubi | DatabaseType::Impala);+ let hive_server_transfer_sql = use_hive_server_cursor.then(|| {transfer_cursor_sql(&col_names,table,@@ -6835,7 +6842,7 @@ whererequest.source_catalog.as_deref(),)});- let mut impala_cursor = ImpalaTransferCursor::default();+ let mut hive_server_cursor = HiveServerTransferCursor::default();let transfer_result: Result<(), String> = async {loop {@@ -6843,10 +6850,17 @@ wherereturn Err("Cancelled".to_string());}- let (result, mysql_spatial_markers) = if let Some(sql) = impala_transfer_sql.as_deref() {+ let (result, mysql_spatial_markers) = if let Some(sql) = hive_server_transfer_sql.as_deref() {(- fetch_impala_transfer_batch(state, source_pool_key, request, sql, batch_size, &mut impala_cursor)- .await?,+ fetch_hive_server_transfer_batch(+ state,+ source_pool_key,+ request,+ sql,+ batch_size,+ &mut hive_server_cursor,+ )+ .await?,false,)} else {@@ -6928,14 +6942,14 @@ whereterminal: false,});- if (use_impala_cursor && !has_more) || (!use_impala_cursor && row_count < batch_size) {+ if (use_hive_server_cursor && !has_more) || (!use_hive_server_cursor && row_count < batch_size) {break;}}Ok(())}.await;- close_impala_transfer_cursor(state, source_pool_key, &mut impala_cursor).await;+ close_hive_server_transfer_cursor(state, source_pool_key, &mut hive_server_cursor).await;transfer_result?;if pg_compat_transfer {@@ -9335,6 +9349,34 @@ mod tests {);}+ #[test]+ fn kyuubi_transfer_uses_spark_sql_compatible_ddl_and_batches() {+ let cols = vec![+ db::ColumnInfo { is_primary_key: true, is_nullable: false, ..test_column("id", "bigint") },+ db::ColumnInfo { is_nullable: false, ..test_column("payload", "jsonb") },+ ];++ let ddl = generate_create_table_ddl(+ &cols,+ "events",+ "public",+ "warehouse",+ &DatabaseType::Kyuubi,+ &DatabaseType::Postgres,+ None,+ None,+ );++ assert!(ddl.contains("CREATE TABLE IF NOT EXISTS `warehouse`.`events`"));+ assert!(ddl.contains("`id` BIGINT"));+ assert!(ddl.contains("`payload` STRING"));+ assert!(!ddl.contains("PRIMARY KEY"));+ assert!(!ddl.contains("NOT NULL"));+ assert_eq!(quote_identifier("user`events", &DatabaseType::Kyuubi), "`user``events`");+ assert_eq!(max_transfer_write_rows(&DatabaseType::Kyuubi, &TransferMode::Append), 500);+ assert_eq!(max_transfer_write_rows(&DatabaseType::Kyuubi, &TransferMode::Upsert), 500);+ }+#[test]fn impala_transfer_uses_impala_compatible_ddl_and_batches() {let cols = vec![diff --git a/crates/dbx-core/tests/database_capabilities.rs b/crates/dbx-core/tests/database_capabilities.rsindex ed9351560d..a175e1df23 100644--- a/crates/dbx-core/tests/database_capabilities.rs+++ b/crates/dbx-core/tests/database_capabilities.rs@@ -97,6 +97,7 @@ fn driver_manifest() -> DriverManifest {fn maps_agent_database_types_to_driver_keys() {assert_eq!(agent_key(&DatabaseType::Trino, None), Some("trino"));assert_eq!(agent_key(&DatabaseType::Hive, None), Some("hive"));+ assert_eq!(agent_key(&DatabaseType::Kyuubi, None), Some("hive"));assert_eq!(agent_key(&DatabaseType::Impala, None), Some("hive"));assert_eq!(agent_key(&DatabaseType::Tdengine, None), Some("tdengine"));assert_eq!(agent_key(&DatabaseType::Iotdb, None), Some("iotdb"));@@ -140,6 +141,7 @@ fn classifies_agent_database_types() {assert!(is_agent_type(&DatabaseType::Oracle));assert!(is_agent_type(&DatabaseType::Trino));assert!(is_agent_type(&DatabaseType::Hive));+ assert!(is_agent_type(&DatabaseType::Kyuubi));assert!(is_agent_type(&DatabaseType::Impala));assert!(is_agent_type(&DatabaseType::Tdengine));assert!(is_agent_type(&DatabaseType::Iotdb));@@ -373,6 +375,25 @@ fn driver_manifest_declares_expected_product_capabilities() {assert!(!impala.capabilities.table_import);assert!(!impala.capabilities.diagram);assert!(!impala.capabilities.user_admin);++ let kyuubi = find_driver(DatabaseType::Kyuubi);+ assert_eq!(kyuubi.label, "Apache Kyuubi");+ assert_eq!(kyuubi.runtime_mode, "agent");+ assert_eq!(kyuubi.agent_key.as_deref(), Some("hive"));+ assert_eq!(kyuubi.support_level, "operate");+ assert!(kyuubi.capabilities.query_execution);+ assert!(kyuubi.capabilities.metadata_browse);+ assert!(kyuubi.capabilities.object_browser);+ assert!(kyuubi.capabilities.object_source);+ assert!(kyuubi.capabilities.schema_search);+ assert!(kyuubi.capabilities.sql_explain);+ assert!(kyuubi.capabilities.data_transfer);+ assert!(kyuubi.capabilities.sql_file_execution);+ assert!(!kyuubi.capabilities.table_data_edit);+ assert!(!kyuubi.capabilities.table_structure_edit);+ assert!(!kyuubi.capabilities.table_import);+ assert!(!kyuubi.capabilities.diagram);+ assert!(!kyuubi.capabilities.user_admin);}#[test]