From 138fd48860434db4cddff1c4f7049a33f42e7c25 Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Fri, 29 May 2026 08:07:25 +0000 Subject: [PATCH] fix(hive): add missing 'service' param and change default auth to NONE in built-in driver The built-in Hive driver only registered 'auth' and 'transport_mode' as additional params, but the connectivity check handler also receives 'service' from the frontend. When SQLE tried SetParamValue("service", ""), it returned "param service not found", blocking Hive data source connectivity tests. Additionally, change the default auth from NOSASL to NONE to match the external plugin behavior and align with HiveServer2 default (hive.server2.authentication=NONE). Ref: http://10.186.63.21/provision/provision/-/work_items/3 --- sqle/driver/hive/hive.go | 11 ++++++++--- sqle/driver/hive/hive_test.go | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/sqle/driver/hive/hive.go b/sqle/driver/hive/hive.go index a83a08056..3c72e4c95 100644 --- a/sqle/driver/hive/hive.go +++ b/sqle/driver/hive/hive.go @@ -214,12 +214,12 @@ func additionalParams() params.Params { return params.Params{ { Key: "auth", - Value: "NOSASL", + Value: "NONE", Desc: "authentication mode", Type: params.ParamTypeString, Enums: []params.EnumsValue{ - {Value: "NOSASL", Desc: "No authentication"}, {Value: "NONE", Desc: "No authentication (SASL)"}, + {Value: "NOSASL", Desc: "No authentication"}, {Value: "LDAP", Desc: "LDAP authentication"}, {Value: "KERBEROS", Desc: "Kerberos authentication"}, }, @@ -234,6 +234,11 @@ func additionalParams() params.Params { {Value: "http", Desc: "HTTP transport"}, }, }, + { + Key: "service", + Desc: "Kerberos service name (optional, used when auth=KERBEROS)", + Type: params.ParamTypeString, + }, } } @@ -253,7 +258,7 @@ func newHiveConnection(dsn *driverV2.DSN) (*gohive.Connection, error) { conf.Database = dsn.DatabaseName } - auth := "NOSASL" + auth := "NONE" if dsn.AdditionalParams != nil { if authParam := dsn.AdditionalParams.GetParam("auth"); authParam != nil { if v := authParam.String(); v != "" { diff --git a/sqle/driver/hive/hive_test.go b/sqle/driver/hive/hive_test.go index fbefa24a4..962d5d9ab 100644 --- a/sqle/driver/hive/hive_test.go +++ b/sqle/driver/hive/hive_test.go @@ -66,10 +66,10 @@ func TestGetDriverMetas(t *testing.T) { if authParam == nil { t.Fatal("expected additionalParams to contain 'auth' param") } - if authParam.Value != "NOSASL" { - t.Errorf("expected auth default value=%q, got %q", "NOSASL", authParam.Value) + if authParam.Value != "NONE" { + t.Errorf("expected auth default value=%q, got %q", "NONE", authParam.Value) } - expectedAuthEnums := []string{"NOSASL", "NONE", "LDAP", "KERBEROS"} + expectedAuthEnums := []string{"NONE", "NOSASL", "LDAP", "KERBEROS"} if len(authParam.Enums) != len(expectedAuthEnums) { t.Fatalf("expected %d auth enums, got %d", len(expectedAuthEnums), len(authParam.Enums)) } @@ -96,6 +96,15 @@ func TestGetDriverMetas(t *testing.T) { t.Errorf("transport_mode enum[%d]: expected %q, got %q", i, expected, transportParam.Enums[i].Value) } } + + // Verify additionalParams: service + serviceParam := metas.DatabaseAdditionalParams.GetParam("service") + if serviceParam == nil { + t.Fatal("expected additionalParams to contain 'service' param") + } + if serviceParam.Value != "" { + t.Errorf("expected service default value=%q, got %q", "", serviceParam.Value) + } } func TestClassifySQL(t *testing.T) {