subkanthi commented on code in PR #678:
URL: https://github.com/apache/iceberg-go/pull/678#discussion_r2739655439


##########
catalog/hive/client.go:
##########
@@ -0,0 +1,147 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package hive
+
+import (
+       "context"
+       "fmt"
+       "net/url"
+       "strconv"
+
+       "github.com/beltran/gohive"
+       "github.com/beltran/gohive/hive_metastore"
+)
+
+type HiveClient interface {
+       Close()
+
+       GetDatabase(ctx context.Context, name string) 
(*hive_metastore.Database, error)
+       CreateDatabase(ctx context.Context, database *hive_metastore.Database) 
error
+       AlterDatabase(ctx context.Context, dbname string, db 
*hive_metastore.Database) error
+       DropDatabase(ctx context.Context, name string, deleteData, cascade 
bool) error
+       GetAllDatabases(ctx context.Context) ([]string, error)
+
+       GetTable(ctx context.Context, dbName, tableName string) 
(*hive_metastore.Table, error)
+       CreateTable(ctx context.Context, tbl *hive_metastore.Table) error
+       AlterTable(ctx context.Context, dbName, tableName string, newTbl 
*hive_metastore.Table) error
+       DropTable(ctx context.Context, dbName, tableName string, deleteData 
bool) error
+       GetTables(ctx context.Context, dbName, pattern string) ([]string, error)
+
+       Lock(ctx context.Context, request *hive_metastore.LockRequest) 
(*hive_metastore.LockResponse, error)
+       CheckLock(ctx context.Context, lockId int64) 
(*hive_metastore.LockResponse, error)
+       Unlock(ctx context.Context, lockId int64) error
+}
+
+type thriftClient struct {
+       client *gohive.HiveMetastoreClient
+}
+
+func NewHiveClient(uri string, opts *HiveOptions) (HiveClient, error) {
+       parsed, err := url.Parse(uri)
+       if err != nil {
+               return nil, fmt.Errorf("invalid URI: %w", err)
+       }
+
+       host := parsed.Hostname()
+       portStr := parsed.Port()
+       if portStr == "" {
+               portStr = "9083"
+       }
+       port, err := strconv.Atoi(portStr)
+       if err != nil {
+               return nil, fmt.Errorf("invalid port: %w", err)
+       }
+
+       // Determine authentication mode
+       auth := "NOSASL"
+       if opts != nil && opts.KerberosAuth {
+               auth = "KERBEROS"

Review Comment:
   can the kerberos implementation go in a separate PR?  



##########
catalog/hive/client.go:
##########
@@ -0,0 +1,147 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package hive
+
+import (
+       "context"
+       "fmt"
+       "net/url"
+       "strconv"
+
+       "github.com/beltran/gohive"
+       "github.com/beltran/gohive/hive_metastore"
+)
+
+type HiveClient interface {
+       Close()
+
+       GetDatabase(ctx context.Context, name string) 
(*hive_metastore.Database, error)
+       CreateDatabase(ctx context.Context, database *hive_metastore.Database) 
error
+       AlterDatabase(ctx context.Context, dbname string, db 
*hive_metastore.Database) error
+       DropDatabase(ctx context.Context, name string, deleteData, cascade 
bool) error
+       GetAllDatabases(ctx context.Context) ([]string, error)
+
+       GetTable(ctx context.Context, dbName, tableName string) 
(*hive_metastore.Table, error)
+       CreateTable(ctx context.Context, tbl *hive_metastore.Table) error
+       AlterTable(ctx context.Context, dbName, tableName string, newTbl 
*hive_metastore.Table) error
+       DropTable(ctx context.Context, dbName, tableName string, deleteData 
bool) error
+       GetTables(ctx context.Context, dbName, pattern string) ([]string, error)
+
+       Lock(ctx context.Context, request *hive_metastore.LockRequest) 
(*hive_metastore.LockResponse, error)
+       CheckLock(ctx context.Context, lockId int64) 
(*hive_metastore.LockResponse, error)
+       Unlock(ctx context.Context, lockId int64) error
+}
+
+type thriftClient struct {
+       client *gohive.HiveMetastoreClient
+}
+
+func NewHiveClient(uri string, opts *HiveOptions) (HiveClient, error) {
+       parsed, err := url.Parse(uri)
+       if err != nil {
+               return nil, fmt.Errorf("invalid URI: %w", err)
+       }
+
+       host := parsed.Hostname()
+       portStr := parsed.Port()
+       if portStr == "" {
+               portStr = "9083"
+       }
+       port, err := strconv.Atoi(portStr)
+       if err != nil {
+               return nil, fmt.Errorf("invalid port: %w", err)
+       }
+
+       // Determine authentication mode
+       auth := "NOSASL"
+       if opts != nil && opts.KerberosAuth {
+               auth = "KERBEROS"

Review Comment:
   Thats correct, can the kerberos implementation go in a separate PR?  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to