diff --git hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java index 540ecd1546..cd7e86a0b5 100644 --- hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java +++ hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/CreateTableHook.java @@ -29,7 +29,7 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.ql.ddl.DDLDesc; import org.apache.hadoop.hive.ql.ddl.DDLTask; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; diff --git itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook.java itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook.java index 8ccbf97067..df8a9b3092 100644 --- itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook.java +++ itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook.java @@ -24,7 +24,7 @@ import java.util.Map; import org.apache.hadoop.hive.ql.ddl.DDLTask; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.parse.ASTNode; import org.apache.hadoop.hive.ql.parse.AbstractSemanticAnalyzerHook; diff --git itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook1.java itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook1.java index 00e7582ecb..f85eceb643 100644 --- itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook1.java +++ itests/util/src/main/java/org/apache/hadoop/hive/ql/metadata/DummySemanticAnalyzerHook1.java @@ -24,7 +24,7 @@ import java.util.Map; import org.apache.hadoop.hive.ql.ddl.DDLTask; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.parse.ASTNode; import org.apache.hadoop.hive.ql.parse.AbstractSemanticAnalyzerHook; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableDesc.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/CreateTableDesc.java similarity index 99% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/CreateTableDesc.java index aeb0fbfa1c..c6e03e37ca 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/CreateTableDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.create; import java.io.Serializable; import java.util.ArrayList; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableOperation.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/CreateTableOperation.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/CreateTableOperation.java index b6b7d1b2fd..6e4ef36e3a 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableOperation.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/CreateTableOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.create; import org.apache.commons.collections.CollectionUtils; import org.apache.hadoop.fs.Path; @@ -35,6 +35,7 @@ import org.apache.hadoop.hive.ql.hooks.WriteEntity; import org.apache.hadoop.hive.ql.hooks.LineageInfo.DataContainer; import org.apache.hadoop.hive.ql.io.AcidUtils; +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.ReplicationSpec; @@ -163,14 +164,12 @@ private void createTableNonReplaceMode(Table tbl) throws HiveException { Path tabLocation = new Path(tTable.getSd().getLocation()); List newFilesList = new ArrayList<>(); try { - context.getDb().listFilesInsideAcidDirectory(tabLocation, - tabLocation.getFileSystem(context.getConf()), newFilesList); + Hive.listFilesInsideAcidDirectory(tabLocation, tabLocation.getFileSystem(context.getConf()), newFilesList); } catch (IOException e) { LOG.error("Error listing files", e); throw new HiveException(e); } - context.getDb().addWriteNotificationLog(createdTable, null, newFilesList, - tTable.getWriteId()); + context.getDb().addWriteNotificationLog(createdTable, null, newFilesList, tTable.getWriteId()); } } } diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/package-info.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/package-info.java similarity index 86% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/package-info.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/package-info.java index 6644b4bd0b..e119c35c8e 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/package-info.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/create/package-info.java @@ -16,5 +16,5 @@ * limitations under the License. */ -/** Table creation related DDL operation descriptions and operations. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +/** Create table DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.table.creation.create; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableLikeDesc.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/CreateTableLikeDesc.java similarity index 98% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableLikeDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/CreateTableLikeDesc.java index 186b474774..138e16f14e 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableLikeDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/CreateTableLikeDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.createlike; import java.io.Serializable; import java.util.Map; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableLikeOperation.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/CreateTableLikeOperation.java similarity index 98% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableLikeOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/CreateTableLikeOperation.java index 8a112619d3..c990085e01 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/CreateTableLikeOperation.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/CreateTableLikeOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.createlike; import static org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE; @@ -35,6 +35,7 @@ import org.apache.hadoop.hive.ql.ddl.DDLOperation; import org.apache.hadoop.hive.ql.ddl.DDLOperationContext; import org.apache.hadoop.hive.ql.ddl.DDLUtils; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableOperation; import org.apache.hadoop.hive.ql.hooks.WriteEntity; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.metadata.Table; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/package-info.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/package-info.java new file mode 100644 index 0000000000..deb5af3055 --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/createlike/package-info.java @@ -0,0 +1,20 @@ +/* + * 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. + */ + +/** Create table like DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.table.creation.createlike; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableAnalyzer.java new file mode 100644 index 0000000000..d623416ef0 --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableAnalyzer.java @@ -0,0 +1,62 @@ +/* + * 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.creation.drop; + +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.conf.HiveConf.ConfVars; +import org.apache.hadoop.hive.ql.QueryState; +import org.apache.hadoop.hive.ql.ddl.DDLWork; +import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType; +import org.apache.hadoop.hive.ql.exec.TaskFactory; +import org.apache.hadoop.hive.ql.hooks.ReadEntity; +import org.apache.hadoop.hive.ql.hooks.WriteEntity; +import org.apache.hadoop.hive.ql.metadata.Table; +import org.apache.hadoop.hive.ql.parse.ASTNode; +import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer; +import org.apache.hadoop.hive.ql.parse.HiveParser; +import org.apache.hadoop.hive.ql.parse.ReplicationSpec; +import org.apache.hadoop.hive.ql.parse.SemanticException; + +/** + * Analyzer for table dropping commands. + */ +@DDLType(type=HiveParser.TOK_DROPTABLE) +public class DropTableAnalyzer extends BaseSemanticAnalyzer { + public DropTableAnalyzer(QueryState queryState) throws SemanticException { + super(queryState); + } + + @Override + public void analyzeInternal(ASTNode root) throws SemanticException { + String tableName = getUnescapedName((ASTNode) root.getChild(0)); + boolean ifExists = (root.getFirstChildWithType(HiveParser.TOK_IFEXISTS) != null); + boolean throwException = !ifExists && !HiveConf.getBoolVar(conf, ConfVars.DROP_IGNORES_NON_EXISTENT); + + Table table = getTable(tableName, throwException); + if (table != null) { + inputs.add(new ReadEntity(table)); + outputs.add(new WriteEntity(table, WriteEntity.WriteType.DDL_EXCLUSIVE)); + } + + boolean purge = (root.getFirstChildWithType(HiveParser.KW_PURGE) != null); + ReplicationSpec replicationSpec = new ReplicationSpec(root); + DropTableDesc desc = new DropTableDesc(tableName, ifExists, purge, replicationSpec); + rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc))); + } +} diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/DropTableDesc.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableDesc.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/DropTableDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableDesc.java index 1410d60017..420be85c86 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/DropTableDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.drop; import java.io.Serializable; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/DropTableOperation.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableOperation.java similarity index 98% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/DropTableOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableOperation.java index 8d852cd40c..a328adbc9c 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/DropTableOperation.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/DropTableOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.drop; import org.apache.hadoop.hive.metastore.conf.MetastoreConf; import org.apache.hadoop.hive.ql.ddl.DDLOperationContext; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/package-info.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/package-info.java new file mode 100644 index 0000000000..8830136cca --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/drop/package-info.java @@ -0,0 +1,20 @@ +/* + * 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. + */ + +/** Drop table DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.table.creation.drop; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableAnalyzer.java new file mode 100644 index 0000000000..f301524d53 --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableAnalyzer.java @@ -0,0 +1,57 @@ +/* + * 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.creation.show; + +import org.apache.hadoop.hive.ql.QueryState; +import org.apache.hadoop.hive.ql.ddl.DDLWork; +import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType; +import org.apache.hadoop.hive.ql.exec.Task; +import org.apache.hadoop.hive.ql.exec.TaskFactory; +import org.apache.hadoop.hive.ql.hooks.ReadEntity; +import org.apache.hadoop.hive.ql.metadata.Table; +import org.apache.hadoop.hive.ql.parse.ASTNode; +import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer; +import org.apache.hadoop.hive.ql.parse.HiveParser; +import org.apache.hadoop.hive.ql.parse.SemanticException; + +/** + * Analyzer for showing table creation commands. + */ +@DDLType(type=HiveParser.TOK_SHOW_CREATETABLE) +public class ShowCreateTableAnalyzer extends BaseSemanticAnalyzer { + public ShowCreateTableAnalyzer(QueryState queryState) throws SemanticException { + super(queryState); + } + + @Override + public void analyzeInternal(ASTNode root) throws SemanticException { + ctx.setResFile(ctx.getLocalTmpPath()); + + String tableName = getUnescapedName((ASTNode)root.getChild(0)); + Table tab = getTable(tableName); + inputs.add(new ReadEntity(tab)); + + ShowCreateTableDesc desc = new ShowCreateTableDesc(tableName, ctx.getResFile().toString()); + Task task = TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)); + rootTasks.add(task); + + task.setFetchSource(true); + setFetchTask(createFetchTask(ShowCreateTableDesc.SCHEMA)); + } +} diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/ShowCreateTableDesc.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableDesc.java similarity index 96% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/ShowCreateTableDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableDesc.java index fb107ceab4..3244e330f2 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/ShowCreateTableDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.show; import java.io.Serializable; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/ShowCreateTableOperation.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableOperation.java similarity index 98% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/ShowCreateTableOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableOperation.java index ac54138c58..aeaf44eed7 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/ShowCreateTableOperation.java +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/ShowCreateTableOperation.java @@ -16,10 +16,11 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.table.creation; +package org.apache.hadoop.hive.ql.ddl.table.creation.show; import org.apache.hadoop.hive.ql.ddl.DDLOperationContext; import org.apache.hadoop.hive.ql.ddl.DDLUtils; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableOperation; import static org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE; diff --git ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/package-info.java ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/package-info.java new file mode 100644 index 0000000000..33411100a9 --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/ddl/table/creation/show/package-info.java @@ -0,0 +1,20 @@ +/* + * 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. + */ + +/** Show create table DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.table.creation.show; diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/load/table/LoadTable.java ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/load/table/LoadTable.java index 8da2b2ed13..e010f46395 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/load/table/LoadTable.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/load/table/LoadTable.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.ql.ErrorMsg; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.DropTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.drop.DropTableDesc; import org.apache.hadoop.hive.ql.exec.ReplCopyTask; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.exec.TaskFactory; diff --git ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java index 67996c6db9..587c1cdc4d 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java @@ -59,7 +59,7 @@ import org.apache.hadoop.hive.metastore.api.TxnType; import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils; import org.apache.hadoop.hive.ql.ErrorMsg; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.hooks.Entity; import org.apache.hadoop.hive.ql.hooks.ReadEntity; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/AcidExportSemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/parse/AcidExportSemanticAnalyzer.java index 424027077a..818cf940a6 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/AcidExportSemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/AcidExportSemanticAnalyzer.java @@ -37,8 +37,8 @@ import org.apache.hadoop.hive.ql.QueryState; import org.apache.hadoop.hive.ql.ddl.DDLTask; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableLikeDesc; -import org.apache.hadoop.hive.ql.ddl.table.creation.DropTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.createlike.CreateTableLikeDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.drop.DropTableDesc; import org.apache.hadoop.hive.ql.ddl.table.misc.AlterTableSetPropertiesDesc; import org.apache.hadoop.hive.ql.exec.StatsTask; import org.apache.hadoop.hive.ql.exec.Task; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java index b08e50e58f..29988f0f79 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java @@ -73,8 +73,6 @@ import org.apache.hadoop.hive.ql.ddl.table.constaint.AlterTableAddConstraintDesc; import org.apache.hadoop.hive.ql.ddl.table.constaint.AlterTableDropConstraintDesc; import org.apache.hadoop.hive.ql.ddl.table.constaint.Constraints; -import org.apache.hadoop.hive.ql.ddl.table.creation.DropTableDesc; -import org.apache.hadoop.hive.ql.ddl.table.creation.ShowCreateTableDesc; import org.apache.hadoop.hive.ql.ddl.table.info.DescTableDesc; import org.apache.hadoop.hive.ql.ddl.table.info.ShowTablePropertiesDesc; import org.apache.hadoop.hive.ql.ddl.table.info.ShowTableStatusDesc; @@ -347,9 +345,6 @@ public void analyzeInternal(ASTNode input) throws SemanticException { } break; } - case HiveParser.TOK_DROPTABLE: - analyzeDropTable(ast); - break; case HiveParser.TOK_TRUNCATETABLE: analyzeTruncateTable(ast); break; @@ -409,10 +404,6 @@ public void analyzeInternal(ASTNode input) throws SemanticException { ctx.setResFile(ctx.getLocalTmpPath()); analyzeShowPartitions(ast); break; - case HiveParser.TOK_SHOW_CREATETABLE: - ctx.setResFile(ctx.getLocalTmpPath()); - analyzeShowCreateTable(ast); - break; case HiveParser.TOK_LOCKTABLE: analyzeLockTable(ast); break; @@ -543,23 +534,6 @@ private int isPartitionValueContinuous(List partitionKeys, return counter; } - private void analyzeDropTable(ASTNode ast) throws SemanticException { - String tableName = getUnescapedName((ASTNode) ast.getChild(0)); - boolean ifExists = (ast.getFirstChildWithType(HiveParser.TOK_IFEXISTS) != null); - boolean throwException = !ifExists && !HiveConf.getBoolVar(conf, ConfVars.DROP_IGNORES_NON_EXISTENT); - - Table table = getTable(tableName, throwException); - if (table != null) { - inputs.add(new ReadEntity(table)); - outputs.add(new WriteEntity(table, WriteEntity.WriteType.DDL_EXCLUSIVE)); - } - - boolean purge = (ast.getFirstChildWithType(HiveParser.KW_PURGE) != null); - ReplicationSpec replicationSpec = new ReplicationSpec(ast); - DropTableDesc dropTableDesc = new DropTableDesc(tableName, ifExists, purge, replicationSpec); - rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), dropTableDesc))); - } - private void analyzeTruncateTable(ASTNode ast) throws SemanticException { ASTNode root = (ASTNode) ast.getChild(0); // TOK_TABLE_PARTITION String tableName = getUnescapedName((ASTNode) root.getChild(0)); @@ -1625,17 +1599,6 @@ private void analyzeShowPartitions(ASTNode ast) throws SemanticException { setFetchTask(createFetchTask(ShowPartitionsDesc.SCHEMA)); } - private void analyzeShowCreateTable(ASTNode ast) throws SemanticException { - ShowCreateTableDesc showCreateTblDesc; - String tableName = getUnescapedName((ASTNode)ast.getChild(0)); - showCreateTblDesc = new ShowCreateTableDesc(tableName, ctx.getResFile().toString()); - - Table tab = getTable(tableName); - inputs.add(new ReadEntity(tab)); - rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showCreateTblDesc))); - setFetchTask(createFetchTask(ShowCreateTableDesc.SCHEMA)); - } - private void analyzeShowTables(ASTNode ast) throws SemanticException { ShowTablesDesc showTblsDesc; String dbName = SessionState.get().getCurrentDatabase(); diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java index ec75fa4e9a..0609f22d89 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java @@ -39,7 +39,7 @@ import org.apache.hadoop.hive.metastore.txn.TxnUtils; import org.apache.hadoop.hive.ql.QueryState; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.DropTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.drop.DropTableDesc; import org.apache.hadoop.hive.ql.ddl.table.partition.AlterTableAddPartitionDesc; import org.apache.hadoop.hive.ql.exec.ReplCopyTask; import org.apache.hadoop.hive.ql.exec.Task; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java index 5f5d7e2ea4..ac542582fc 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java @@ -23,7 +23,7 @@ import org.apache.hadoop.hive.ql.Context; import org.apache.hadoop.hive.ql.QueryProperties; import org.apache.hadoop.hive.ql.QueryState; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.ddl.view.materialized.update.MaterializedViewUpdateDesc; import org.apache.hadoop.hive.ql.exec.AbstractMapJoinOperator; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java index 9f5c55174a..0d67b8602e 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java @@ -30,7 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.metadata.Table; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index e9b035d3b4..6633e97b01 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -106,8 +106,8 @@ import org.apache.hadoop.hive.ql.cache.results.QueryResultsCache; import org.apache.hadoop.hive.ql.ddl.DDLWork; import org.apache.hadoop.hive.ql.ddl.misc.hooks.InsertCommitHookDesc; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableLikeDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.createlike.CreateTableLikeDesc; import org.apache.hadoop.hive.ql.ddl.table.misc.AlterTableUnsetPropertiesDesc; import org.apache.hadoop.hive.ql.ddl.table.misc.PreInsertTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java index 855c3b6d6d..b65db741fa 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java @@ -105,14 +105,12 @@ private static BaseSemanticAnalyzer getInternal(QueryState queryState, ASTNode t queryState.setCommandType(HiveOperation.ALTERVIEW_AS); return new SemanticAnalyzer(queryState); } - case HiveParser.TOK_DROPTABLE: case HiveParser.TOK_DESCTABLE: case HiveParser.TOK_MSCK: case HiveParser.TOK_SHOWTABLES: case HiveParser.TOK_SHOWCOLUMNS: case HiveParser.TOK_SHOW_TABLESTATUS: case HiveParser.TOK_SHOW_TBLPROPERTIES: - case HiveParser.TOK_SHOW_CREATETABLE: case HiveParser.TOK_SHOWPARTITIONS: case HiveParser.TOK_SHOWLOCKS: case HiveParser.TOK_SHOWDBLOCKS: diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java index ec46280627..04c1d822d8 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java @@ -35,7 +35,7 @@ import org.apache.hadoop.hive.ql.ddl.DDLDesc; import org.apache.hadoop.hive.ql.ddl.DDLTask; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rewrite.AlterMaterializedViewRewriteDesc; import org.apache.hadoop.hive.ql.ddl.view.materialized.update.MaterializedViewUpdateDesc; diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java index 0f1f05bb24..ea5fec8bad 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/DropTableHandler.java @@ -20,7 +20,7 @@ import org.apache.hadoop.hive.metastore.messaging.AlterTableMessage; import org.apache.hadoop.hive.metastore.messaging.DropTableMessage; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.DropTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.drop.DropTableDesc; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.exec.TaskFactory; import org.apache.hadoop.hive.ql.parse.SemanticException; diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java index 09d8089c5c..c34fc6c63c 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java @@ -31,7 +31,7 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.Order; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.exec.Task; import org.apache.hadoop.hive.ql.exec.TaskFactory; diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java index 26568ef003..a1e72afdf9 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java @@ -21,7 +21,7 @@ import java.io.Serializable; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.io.AcidUtils; diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java index e20f6956b2..c992a52c45 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java @@ -42,7 +42,7 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.exec.ColumnInfo; import org.apache.hadoop.hive.ql.exec.RowSchema; diff --git ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MmMajorQueryCompactor.java ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MmMajorQueryCompactor.java index f7e0a85c1f..47febe9fe5 100644 --- ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MmMajorQueryCompactor.java +++ ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MmMajorQueryCompactor.java @@ -36,7 +36,7 @@ import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; import org.apache.hadoop.hive.metastore.txn.CompactionInfo; import org.apache.hadoop.hive.ql.DriverUtils; -import org.apache.hadoop.hive.ql.ddl.table.creation.ShowCreateTableOperation; +import org.apache.hadoop.hive.ql.ddl.table.creation.show.ShowCreateTableOperation; import org.apache.hadoop.hive.ql.io.AcidOutputFormat; import org.apache.hadoop.hive.ql.io.AcidUtils; import org.apache.hadoop.hive.ql.metadata.HiveException; diff --git ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java index c81ab2d6a7..ce60bd6d44 100644 --- ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java +++ ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java @@ -24,7 +24,7 @@ import org.apache.hadoop.hive.ql.QueryPlan; import org.apache.hadoop.hive.ql.ddl.DDLTask; import org.apache.hadoop.hive.ql.ddl.DDLWork; -import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; +import org.apache.hadoop.hive.ql.ddl.table.creation.create.CreateTableDesc; import org.apache.hadoop.hive.ql.processors.CommandProcessorException; import org.apache.hadoop.hive.ql.session.SessionState; import org.junit.Assert;