miklosgergely commented on a change in pull request #543: HIVE-21292: Break up 
DDLTask 1 - extract Database related operations
URL: https://github.com/apache/hive/pull/543#discussion_r264137508
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/ddl/database/DescDatabaseOperation.java
 ##########
 @@ -0,0 +1,73 @@
+/*
+ * 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.hadoop.hive.ql.exec.ddl.database;
+
+import java.io.DataOutputStream;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.PrincipalType;
+import org.apache.hadoop.hive.ql.ErrorMsg;
+import org.apache.hadoop.hive.ql.exec.ddl.DDLOperation;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.io.IOUtils;
+
+/**
+ * Operation process of describing a database.
+ */
+public class DescDatabaseOperation extends DDLOperation<DescDatabaseDesc> {
+  @Override
+  public int execute() throws HiveException {
+    DataOutputStream outStream = getOutputStream(ddlDesc.getResFile());
+    try {
+      Database database = db.getDatabase(ddlDesc.getDatabaseName());
+      if (database == null) {
+        throw new HiveException(ErrorMsg.DATABASE_NOT_EXISTS, 
ddlDesc.getDatabaseName());
+      }
+
+      Map<String, String> params = null;
+      if (ddlDesc.isExt()) {
+        params = database.getParameters();
+      }
+
+      // If this is a q-test, let's order the params map (lexicographically) by
+      // key. This is to get consistent param ordering between Java7 and Java8.
+      if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_IN_TEST) && params 
!= null) {
+        params = new TreeMap<String, String>(params);
 
 Review comment:
   HIVE-21420 opened

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to