[ https://issues.apache.org/jira/browse/HIVE-22747?focusedWorklogId=385418&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-385418 ]
ASF GitHub Bot logged work on HIVE-22747: ----------------------------------------- Author: ASF GitHub Bot Created on: 11/Feb/20 19:54 Start Date: 11/Feb/20 19:54 Worklog Time Spent: 10m Work Description: miklosgergely commented on pull request #882: HIVE-22747 Break up DDLSemanticAnalyzer - extract Table info and lock analyzers URL: https://github.com/apache/hive/pull/882#discussion_r377863758 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/info/TableInfoUtils.java ########## @@ -0,0 +1,53 @@ +/* + * 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.ddl.table.info; + +import java.util.Map; + +import org.apache.hadoop.hive.ql.ErrorMsg; +import org.apache.hadoop.hive.ql.ddl.table.partition.PartitionUtils; +import org.apache.hadoop.hive.ql.metadata.Hive; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.metadata.Table; +import org.apache.hadoop.hive.ql.parse.SemanticException; + +/** + * Utilities used by table information DDL commands. + */ +public final class TableInfoUtils { + private TableInfoUtils() { + throw new UnsupportedOperationException("TableInfoUtils should not be instantiated"); + } + + public static void validateDatabase(Hive db, String databaseName) throws SemanticException { + try { + if (!db.databaseExists(databaseName)) { + throw new SemanticException(ErrorMsg.DATABASE_NOT_EXISTS.getMsg(databaseName)); + } + } catch (HiveException e) { + throw new SemanticException(ErrorMsg.DATABASE_NOT_EXISTS.getMsg(databaseName), e); + } + } + + public static void validateTable(Hive db, Table table, Map<String, String> partSpec) throws SemanticException { + if (partSpec != null) { Review comment: Fixed. ---------------------------------------------------------------- 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 Issue Time Tracking ------------------- Worklog Id: (was: 385418) Time Spent: 2h 10m (was: 2h) > Break up DDLSemanticAnalyzer - extract Table info and lock analyzers > -------------------------------------------------------------------- > > Key: HIVE-22747 > URL: https://issues.apache.org/jira/browse/HIVE-22747 > Project: Hive > Issue Type: Sub-task > Reporter: Miklos Gergely > Assignee: Miklos Gergely > Priority: Major > Labels: pull-request-available, refactor-ddl > Attachments: HIVE-22747.01.patch, HIVE-22747.02.patch, > HIVE-22747.03.patch > > Time Spent: 2h 10m > Remaining Estimate: 0h > > DDLSemanticAnalyzer is a huge class, more than 4000 lines long. The goal is > to refactor it in order to have everything cut into more handleable classes > under the packageĀ org.apache.hadoop.hive.ql.exec.ddl: > * have a separate class for each analyzers > * have a package for each operation, containing an analyzer, a description, > and an operation, so the amount of classes under a package is more manageable > Step #13: extract the table info and lock related analyzers from > DDLSemanticAnalyzer, and move them under the new package. -- This message was sent by Atlassian Jira (v8.3.4#803005)