Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sqle/driver/hive/hive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
Expand All @@ -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,
},
}
}

Expand All @@ -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 != "" {
Expand Down
15 changes: 12 additions & 3 deletions sqle/driver/hive/hive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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) {
Expand Down
Loading