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) {