EmmyMiao87 commented on a change in pull request #6569:
URL: https://github.com/apache/incubator-doris/pull/6569#discussion_r725451743



##########
File path: fe/fe-core/pom.xml
##########
@@ -650,6 +650,25 @@ under the License.
             <groupId>io.grpc</groupId>
             <artifactId>grpc-stub</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.hive</groupId>
+            <artifactId>hive-metastore</artifactId>

Review comment:
       Add version is better for third-party dependency

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3951,6 +3952,13 @@ private void createHiveTable(Database db, 
CreateTableStmt stmt) throws DdlExcept
         long tableId = getNextId();
         HiveTable hiveTable = new HiveTable(tableId, tableName, columns, 
stmt.getProperties());
         hiveTable.setComment(stmt.getComment());
+        // check hive table if exists in hive database
+        HiveMetaStoreClient hiveMetaStoreClient =
+                
HiveMetaStoreClientHelper.getClient(hiveTable.getHiveProperties().get(HiveTable.HIVE_METASTORE_URIS));

Review comment:
       Is it possible to have a null pointer if user does not fill in the ``` 
HiveTable.HIVE_METASTORE_URIS ``` property?

##########
File path: fe/fe-core/pom.xml
##########
@@ -650,6 +650,25 @@ under the License.
             <groupId>io.grpc</groupId>
             <artifactId>grpc-stub</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.hive</groupId>
+            <artifactId>hive-metastore</artifactId>
+            <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <artifactId>servlet-api</artifactId>
+                    <groupId>javax.servlet</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.hive</groupId>
+            <artifactId>hive-exec</artifactId>
+            <classifier>core</classifier>

Review comment:
       same as above

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3951,6 +3952,13 @@ private void createHiveTable(Database db, 
CreateTableStmt stmt) throws DdlExcept
         long tableId = getNextId();
         HiveTable hiveTable = new HiveTable(tableId, tableName, columns, 
stmt.getProperties());
         hiveTable.setComment(stmt.getComment());
+        // check hive table if exists in hive database
+        HiveMetaStoreClient hiveMetaStoreClient =
+                
HiveMetaStoreClientHelper.getClient(hiveTable.getHiveProperties().get(HiveTable.HIVE_METASTORE_URIS));
+        if (!HiveMetaStoreClientHelper.tableExists(hiveMetaStoreClient, 
hiveTable.getHiveDb(), hiveTable.getHiveTable())) {

Review comment:
       Should client be closed? 

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
##########
@@ -0,0 +1,552 @@
+// 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 org.apache.doris.catalog;

Review comment:
       maybe put it into external.hive package is better?

##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/HiveTable.java
##########
@@ -127,4 +130,13 @@ public void readFields(DataInput in) throws IOException {
             hiveProperties.put(key, val);
         }
     }
+
+    @Override
+    public TTableDescriptor toThrift() {
+        THiveTable tHiveTable = new THiveTable(getHiveDb(), getHiveTable(), 
getHiveProperties());
+        TTableDescriptor tTableDescriptor = new TTableDescriptor(getId(), 
TTableType.BROKER_TABLE,

Review comment:
       broker table?




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