From f6bfb27df1363ad03893732b54a875ae188be0a7 Mon Sep 17 00:00:00 2001 From: miklosgergely Date: Thu, 19 Sep 2019 23:28:19 +0200 Subject: [PATCH] HIVE-22276 Break up DDLSemanticAnalyzer - extract View related analyzers --- .../ql/ddl/DDLSemanticAnalyzerFactory.java | 11 +- .../ddl/view/{ => create}/CreateViewDesc.java | 2 +- .../{ => create}/CreateViewOperation.java | 2 +- .../hive/ql/ddl/view/create/package-info.java | 20 ++++ .../ql/ddl/view/drop/DropViewAnalyzer.java | 59 ++++++++++ .../ql/ddl/view/{ => drop}/DropViewDesc.java | 2 +- .../view/{ => drop}/DropViewOperation.java | 2 +- .../hive/ql/ddl/view/drop/package-info.java | 20 ++++ ...AlterMaterializedViewRebuildAnalyzer.java} | 73 ++++++------ .../alter/rebuild/package-info.java | 20 ++++ .../AlterMaterializedViewRewriteAnalyzer.java | 107 ++++++++++++++++++ .../AlterMaterializedViewRewriteDesc.java | 2 +- ...AlterMaterializedViewRewriteOperation.java | 2 +- .../alter/rewrite/package-info.java | 20 ++++ .../drop/DropMaterializedViewAnalyzer.java | 59 ++++++++++ .../drop}/DropMaterializedViewDesc.java | 2 +- .../drop}/DropMaterializedViewOperation.java | 2 +- .../view/materialized/drop/package-info.java | 20 ++++ .../update}/MaterializedViewUpdateDesc.java | 8 +- .../MaterializedViewUpdateOperation.java | 2 +- .../materialized/update/package-info.java | 20 ++++ .../hive/ql/parse/DDLSemanticAnalyzer.java | 106 ----------------- .../apache/hadoop/hive/ql/parse/HiveParser.g | 35 +++--- .../hadoop/hive/ql/parse/ParseContext.java | 4 +- .../org/apache/hadoop/hive/ql/parse/QB.java | 2 +- .../hive/ql/parse/SemanticAnalyzer.java | 4 +- .../ql/parse/SemanticAnalyzerFactory.java | 18 --- .../hadoop/hive/ql/parse/TaskCompiler.java | 6 +- .../hadoop/hive/ql/plan/ImportTableDesc.java | 2 +- .../hadoop/hive/ql/plan/LoadFileDesc.java | 2 +- .../apache/hadoop/hive/ql/plan/PlanUtils.java | 2 +- .../results/clientnegative/masking_mv.q.out | 2 +- .../clientnegative/strict_pruning_2.q.out | 2 +- .../materialized_view_create_rewrite.q.out | 2 +- .../clientpositive/druid/druidmini_mv.q.out | 2 +- .../llap/materialized_view_cluster.q.out | 10 +- .../materialized_view_create_rewrite.q.out | 2 +- .../materialized_view_create_rewrite_3.q.out | 4 +- .../materialized_view_create_rewrite_4.q.out | 10 +- .../materialized_view_create_rewrite_5.q.out | 8 +- ...terialized_view_create_rewrite_dummy.q.out | 4 +- ...ed_view_create_rewrite_rebuild_dummy.q.out | 4 +- ...ized_view_create_rewrite_time_window.q.out | 4 +- .../materialized_view_distribute_sort.q.out | 10 +- .../materialized_view_partition_cluster.q.out | 10 +- .../llap/materialized_view_partitioned.q.out | 6 +- .../materialized_view_partitioned_3.q.out | 2 +- .../results/clientpositive/masking_mv.q.out | 4 +- 48 files changed, 478 insertions(+), 244 deletions(-) rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => create}/CreateViewDesc.java (99%) rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => create}/CreateViewOperation.java (98%) create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/package-info.java create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewAnalyzer.java rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => drop}/DropViewDesc.java (97%) rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => drop}/DropViewOperation.java (97%) create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/package-info.java rename ql/src/java/org/apache/hadoop/hive/ql/{parse/MaterializedViewRebuildSemanticAnalyzer.java => ddl/view/materialized/alter/rebuild/AlterMaterializedViewRebuildAnalyzer.java} (63%) create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/package-info.java create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => materialized/alter/rewrite}/AlterMaterializedViewRewriteDesc.java (97%) rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => materialized/alter/rewrite}/AlterMaterializedViewRewriteOperation.java (97%) create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/package-info.java create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewAnalyzer.java rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => materialized/drop}/DropMaterializedViewDesc.java (96%) rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => materialized/drop}/DropMaterializedViewOperation.java (97%) create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/package-info.java rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => materialized/update}/MaterializedViewUpdateDesc.java (89%) rename ql/src/java/org/apache/hadoop/hive/ql/ddl/view/{ => materialized/update}/MaterializedViewUpdateOperation.java (98%) create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/package-info.java diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLSemanticAnalyzerFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLSemanticAnalyzerFactory.java index efbd90f2c58f..90cf1a1413a5 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLSemanticAnalyzerFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/DDLSemanticAnalyzerFactory.java @@ -29,10 +29,13 @@ import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.parse.ASTNode; import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer; +import org.apache.hadoop.hive.ql.parse.CalcitePlanner; import org.reflections.Reflections; import com.google.common.annotations.VisibleForTesting; +import avro.shaded.com.google.common.collect.Sets; + /** * Manages the DDL command analyzers. */ @@ -49,11 +52,15 @@ private DDLSemanticAnalyzerFactory() { int type(); } + private static final String DDL_ROOT = "org.apache.hadoop.hive.ql.ddl"; private static final Map> TYPE_TO_ANALYZER = new HashMap<>(); static { - Set> analyzerClasses = - new Reflections("org.apache.hadoop.hive.ql.ddl").getSubTypesOf(BaseSemanticAnalyzer.class); + Set> analyzerClasses1 = + new Reflections(DDL_ROOT).getSubTypesOf(BaseSemanticAnalyzer.class); + Set> analyzerClasses2 = + new Reflections(DDL_ROOT).getSubTypesOf(CalcitePlanner.class); + Set> analyzerClasses = Sets.union(analyzerClasses1, analyzerClasses2); for (Class analyzerClass : analyzerClasses) { if (Modifier.isAbstract(analyzerClass.getModifiers())) { continue; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/CreateViewDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewDesc.java similarity index 99% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/CreateViewDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewDesc.java index 31bb7cad6dcc..1f304782ff55 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/CreateViewDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.create; import java.io.Serializable; import java.util.List; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/CreateViewOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewOperation.java similarity index 98% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/CreateViewOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewOperation.java index 2176fd572c3c..f7952a5cc1c4 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/CreateViewOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.create; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.ValidTxnWriteIdList; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/package-info.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/package-info.java new file mode 100644 index 000000000000..a80d2cb3c87e --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/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 view DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.view.create; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewAnalyzer.java new file mode 100644 index 000000000000..92a2460db82f --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewAnalyzer.java @@ -0,0 +1,59 @@ +/* + * 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.view.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.SemanticException; + +/** + * Analyzer for drop view commands. + */ +@DDLType(type=HiveParser.TOK_DROPVIEW) +public class DropViewAnalyzer extends BaseSemanticAnalyzer { + public DropViewAnalyzer(QueryState queryState) throws SemanticException { + super(queryState); + } + + @Override + public void analyzeInternal(ASTNode root) throws SemanticException { + String viewName = 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 view = getTable(viewName, throwException); + if (view != null) { + inputs.add(new ReadEntity(view)); + outputs.add(new WriteEntity(view, WriteEntity.WriteType.DDL_EXCLUSIVE)); + } + + DropViewDesc desc = new DropViewDesc(viewName, ifExists); + rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc))); + } +} diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropViewDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewDesc.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropViewDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewDesc.java index 0ffb007890f5..9940d724faac 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropViewDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.drop; import java.io.Serializable; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropViewOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewOperation.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropViewOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewOperation.java index 26f3dedb8f80..a029b6cca49e 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropViewOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/DropViewOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.drop; import org.apache.hadoop.hive.ql.ddl.DDLOperationContext; import org.apache.hadoop.hive.ql.ddl.DDLUtils; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/package-info.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/drop/package-info.java new file mode 100644 index 000000000000..2664ee679ce6 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/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 view DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.view.drop; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/MaterializedViewRebuildSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/AlterMaterializedViewRebuildAnalyzer.java similarity index 63% rename from ql/src/java/org/apache/hadoop/hive/ql/parse/MaterializedViewRebuildSemanticAnalyzer.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/AlterMaterializedViewRebuildAnalyzer.java index 7a3c16390c3d..58eacde5eb25 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/MaterializedViewRebuildSemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/AlterMaterializedViewRebuildAnalyzer.java @@ -16,70 +16,82 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.parse; +package org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rebuild; import org.apache.hadoop.hive.metastore.api.LockState; import org.apache.hadoop.hive.ql.Context; import org.apache.hadoop.hive.ql.ErrorMsg; import org.apache.hadoop.hive.ql.QueryState; +import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType; import org.apache.hadoop.hive.ql.io.AcidUtils; import org.apache.hadoop.hive.ql.lockmgr.HiveTxnManager; import org.apache.hadoop.hive.ql.lockmgr.LockException; import org.apache.hadoop.hive.ql.metadata.Table; -import org.apache.hadoop.hive.ql.session.SessionState; -import org.apache.hadoop.hive.ql.session.SessionState.LogHelper; +import org.apache.hadoop.hive.ql.parse.ASTNode; +import org.apache.hadoop.hive.ql.parse.CalcitePlanner; +import org.apache.hadoop.hive.ql.parse.HiveParser; +import org.apache.hadoop.hive.ql.parse.ParseUtils; +import org.apache.hadoop.hive.ql.parse.SemanticException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * MaterializedViewRebuildSemanticAnalyzer. - * Rewrites ALTER MATERIALIZED VIEW _mv_name_ REBUILD statement into - * INSERT OVERWRITE TABLE _mv_name_ _mv_query_ . + * Analyzer for alter materialized view rebuild commands. */ -public class MaterializedViewRebuildSemanticAnalyzer extends CalcitePlanner { +@DDLType(type=HiveParser.TOK_ALTER_MATERIALIZED_VIEW_REBUILD) +public class AlterMaterializedViewRebuildAnalyzer extends CalcitePlanner { + private static final Logger LOG = LoggerFactory.getLogger(AlterMaterializedViewRebuildAnalyzer.class); - private static final Logger LOG = - LoggerFactory.getLogger(MaterializedViewRebuildSemanticAnalyzer.class); - - - public MaterializedViewRebuildSemanticAnalyzer(QueryState queryState) throws SemanticException { + public AlterMaterializedViewRebuildAnalyzer(QueryState queryState) throws SemanticException { super(queryState); } - @Override - public void analyzeInternal(ASTNode ast) throws SemanticException { + public void analyzeInternal(ASTNode root) throws SemanticException { if (mvRebuildMode != MaterializationRebuildMode.NONE) { - super.analyzeInternal(ast); + super.analyzeInternal(root); return; } - String[] qualifiedTableName = getQualifiedTableName((ASTNode) ast.getChild(0)); + String[] qualifiedTableName = getQualifiedTableName((ASTNode)root.getChild(0)); String dbDotTable = getDotName(qualifiedTableName); + ASTNode rewrittenAST = getRewrittenAST(qualifiedTableName, dbDotTable); + + mvRebuildMode = MaterializationRebuildMode.INSERT_OVERWRITE_REBUILD; + mvRebuildDbName = qualifiedTableName[0]; + mvRebuildName = qualifiedTableName[1]; + + LOG.debug("Rebuilding materialized view " + dbDotTable); + super.analyzeInternal(rewrittenAST); + } + + private static final String REWRITTEN_INSERT_STATEMENT = "INSERT OVERWRITE TABLE `%s`.`%s` %s"; + + private ASTNode getRewrittenAST(String[] qualifiedTableName, String dbDotTable) throws SemanticException { ASTNode rewrittenAST; // We need to go lookup the table and get the select statement and then parse it. try { - Table tab = getTableObjectByName(dbDotTable, true); - if (!tab.isMaterializedView()) { - // Cannot rebuild not materialized view + Table table = getTableObjectByName(dbDotTable, true); + if (!table.isMaterializedView()) { throw new SemanticException(ErrorMsg.REBUILD_NO_MATERIALIZED_VIEW); } + // We need to use the expanded text for the materialized view, as it will contain // the qualified table aliases, etc. - String viewText = tab.getViewExpandedText(); + String viewText = table.getViewExpandedText(); if (viewText.trim().isEmpty()) { throw new SemanticException(ErrorMsg.MATERIALIZED_VIEW_DEF_EMPTY); } + Context ctx = new Context(queryState.getConf()); - rewrittenAST = ParseUtils.parse("insert overwrite table " + - "`" + qualifiedTableName[0] + "`.`" + qualifiedTableName[1] + "` " + - viewText, ctx); + String rewrittenInsertStatement = String.format(REWRITTEN_INSERT_STATEMENT, qualifiedTableName[0], + qualifiedTableName[1], viewText); + rewrittenAST = ParseUtils.parse(rewrittenInsertStatement, ctx); this.ctx.addRewrittenStatementContext(ctx); - if (!this.ctx.isExplainPlan() && AcidUtils.isTransactionalTable(tab)) { - // Acquire lock for the given materialized view. Only one rebuild per materialized - // view can be triggered at a given time, as otherwise we might produce incorrect - // results if incremental maintenance is triggered. + if (!this.ctx.isExplainPlan() && AcidUtils.isTransactionalTable(table)) { + // Acquire lock for the given materialized view. Only one rebuild per materialized view can be triggered at a + // given time, as otherwise we might produce incorrect results if incremental maintenance is triggered. HiveTxnManager txnManager = getTxnMgr(); LockState state; try { @@ -95,11 +107,6 @@ public void analyzeInternal(ASTNode ast) throws SemanticException { } catch (Exception e) { throw new SemanticException(e); } - mvRebuildMode = MaterializationRebuildMode.INSERT_OVERWRITE_REBUILD; - mvRebuildDbName = qualifiedTableName[0]; - mvRebuildName = qualifiedTableName[1]; - - LOG.debug("Rebuilding materialized view " + dbDotTable); - super.analyzeInternal(rewrittenAST); + return rewrittenAST; } } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/package-info.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/package-info.java new file mode 100644 index 000000000000..a982b10bc677 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rebuild/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. + */ + +/** Rebuild materialized view DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rebuild; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java new file mode 100644 index 000000000000..19447ea5d452 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java @@ -0,0 +1,107 @@ +/* + * 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.view.materialized.alter.rewrite; + +import org.apache.hadoop.hive.ql.QueryState; +import org.apache.hadoop.hive.ql.ddl.DDLWork; +import org.apache.hadoop.hive.ql.ddl.DDLDesc.DDLDescWithWriteId; +import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType; +import org.apache.hadoop.hive.ql.ddl.view.materialized.update.MaterializedViewUpdateDesc; +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.hooks.WriteEntity; +import org.apache.hadoop.hive.ql.io.AcidUtils; +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 alter materialized view rewrite commands. + */ +@DDLType(type=HiveParser.TOK_ALTER_MATERIALIZED_VIEW_REWRITE) +public class AlterMaterializedViewRewriteAnalyzer extends BaseSemanticAnalyzer { + public AlterMaterializedViewRewriteAnalyzer(QueryState queryState) throws SemanticException { + super(queryState); + } + + private DDLDescWithWriteId ddlDescWithWriteId; + + @Override + public void analyzeInternal(ASTNode root) throws SemanticException { + String[] qualified = getQualifiedTableName((ASTNode)root.getChild(0)); + String fqMaterializedViewName = getDotName(qualified); + + // Value for the flag + boolean rewriteEnable; + switch (root.getChild(1).getType()) { + case HiveParser.TOK_REWRITE_ENABLED: + rewriteEnable = true; + break; + case HiveParser.TOK_REWRITE_DISABLED: + rewriteEnable = false; + break; + default: + throw new SemanticException("Invalid alter materialized view expression"); + } + + // It can be fully qualified name or use default database + Table materializedViewTable = getTable(fqMaterializedViewName, true); + + // One last test: if we are enabling the rewrite, we need to check that query + // only uses transactional (MM and ACID) tables + if (rewriteEnable) { + for (String tableName : materializedViewTable.getCreationMetadata().getTablesUsed()) { + Table table = getTable(tableName, true); + if (!AcidUtils.isTransactionalTable(table)) { + throw new SemanticException("Automatic rewriting for materialized view cannot be enabled if the " + + "materialized view uses non-transactional tables"); + } + } + } + + AlterMaterializedViewRewriteDesc desc = new AlterMaterializedViewRewriteDesc(fqMaterializedViewName, rewriteEnable); + if (AcidUtils.isTransactionalTable(materializedViewTable)) { + ddlDescWithWriteId = desc; + } + + inputs.add(new ReadEntity(materializedViewTable)); + outputs.add(new WriteEntity(materializedViewTable, WriteEntity.WriteType.DDL_EXCLUSIVE)); + + // Create task for alterMVRewriteDesc + DDLWork work = new DDLWork(getInputs(), getOutputs(), desc); + Task targetTask = TaskFactory.get(work); + + // Create task to update rewrite flag as dependant of previous one + MaterializedViewUpdateDesc materializedViewUpdateDesc = + new MaterializedViewUpdateDesc(fqMaterializedViewName, rewriteEnable, !rewriteEnable, false); + DDLWork updateDdlWork = new DDLWork(getInputs(), getOutputs(), materializedViewUpdateDesc); + targetTask.addDependentTask(TaskFactory.get(updateDdlWork, conf)); + + // Add root task + rootTasks.add(targetTask); + } + + @Override + public DDLDescWithWriteId getAcidDdlDesc() { + return ddlDescWithWriteId; + } +} diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/AlterMaterializedViewRewriteDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteDesc.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/AlterMaterializedViewRewriteDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteDesc.java index 0e3df61cfc8c..01807150fe11 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/AlterMaterializedViewRewriteDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rewrite; import org.apache.hadoop.hive.ql.ddl.DDLDesc.DDLDescWithWriteId; import org.apache.hadoop.hive.ql.plan.Explain; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/AlterMaterializedViewRewriteOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteOperation.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/AlterMaterializedViewRewriteOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteOperation.java index 1853371e2fdc..426daa6db68c 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/AlterMaterializedViewRewriteOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rewrite; import org.apache.calcite.rel.RelNode; import org.apache.hadoop.hive.common.StatsSetupConst; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/package-info.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/package-info.java new file mode 100644 index 000000000000..9f996d41054f --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/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. + */ + +/** Rewrite materialized view DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rewrite; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewAnalyzer.java new file mode 100644 index 000000000000..f242ab9a3c95 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewAnalyzer.java @@ -0,0 +1,59 @@ +/* + * 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.view.materialized.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.SemanticException; + +/** + * Analyzer for drop materialized view commands. + */ +@DDLType(type=HiveParser.TOK_DROP_MATERIALIZED_VIEW) +public class DropMaterializedViewAnalyzer extends BaseSemanticAnalyzer { + public DropMaterializedViewAnalyzer(QueryState queryState) throws SemanticException { + super(queryState); + } + + @Override + public void analyzeInternal(ASTNode root) throws SemanticException { + String viewName = 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 materializedView = getTable(viewName, throwException); + if (materializedView != null) { + inputs.add(new ReadEntity(materializedView)); + outputs.add(new WriteEntity(materializedView, WriteEntity.WriteType.DDL_EXCLUSIVE)); + } + + DropMaterializedViewDesc desc = new DropMaterializedViewDesc(viewName, ifExists); + rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc))); + } +} diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropMaterializedViewDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewDesc.java similarity index 96% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropMaterializedViewDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewDesc.java index 3f3f78daa428..7ba6659c88ce 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropMaterializedViewDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewDesc.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.materialized.drop; import java.io.Serializable; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropMaterializedViewOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewOperation.java similarity index 97% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropMaterializedViewOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewOperation.java index 21b456aa457e..93b25d4be3c7 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/DropMaterializedViewOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/DropMaterializedViewOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.materialized.drop; import org.apache.hadoop.hive.ql.ddl.DDLOperationContext; import org.apache.hadoop.hive.ql.ddl.DDLUtils; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/package-info.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/drop/package-info.java new file mode 100644 index 000000000000..324a8775a146 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/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 materialized view DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.view.materialized.drop; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/MaterializedViewUpdateDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateDesc.java similarity index 89% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/MaterializedViewUpdateDesc.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateDesc.java index 674a2569796b..aa21359e72ad 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/MaterializedViewUpdateDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateDesc.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.materialized.update; import org.apache.hadoop.hive.ql.ddl.DDLDesc; import org.apache.hadoop.hive.ql.plan.Explain; @@ -48,19 +48,19 @@ public String getName() { return name; } - @Explain(displayName = "retrieveAndInclude", displayOnlyOnTrue = true, + @Explain(displayName = "retrieve and include", displayOnlyOnTrue = true, explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public boolean isRetrieveAndInclude() { return retrieveAndInclude; } - @Explain(displayName = "disableRewrite", displayOnlyOnTrue = true, + @Explain(displayName = "disable rewrite", displayOnlyOnTrue = true, explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public boolean isDisableRewrite() { return disableRewrite; } - @Explain(displayName = "updateCreationMetadata", displayOnlyOnTrue = true, + @Explain(displayName = "update creation metadata", displayOnlyOnTrue = true, explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public boolean isUpdateCreationMetadata() { return updateCreationMetadata; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/MaterializedViewUpdateOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateOperation.java similarity index 98% rename from ql/src/java/org/apache/hadoop/hive/ql/ddl/view/MaterializedViewUpdateOperation.java rename to ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateOperation.java index 4154cb2c741c..636b9d3d430b 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/MaterializedViewUpdateOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateOperation.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.hive.ql.ddl.view; +package org.apache.hadoop.hive.ql.ddl.view.materialized.update; import org.apache.hadoop.hive.common.ValidTxnWriteIdList; import org.apache.hadoop.hive.metastore.api.CreationMetadata; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/package-info.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/package-info.java new file mode 100644 index 000000000000..e2cd516aa7ec --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/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. + */ + +/** Update materialized view DDL operation. */ +package org.apache.hadoop.hive.ql.ddl.view.materialized.update; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java index 7b0e5e0c5e98..5bb03a98bd35 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java @@ -112,10 +112,6 @@ import org.apache.hadoop.hive.ql.ddl.table.storage.AlterTableSetSkewedLocationDesc; import org.apache.hadoop.hive.ql.ddl.table.storage.AlterTableSkewedByDesc; import org.apache.hadoop.hive.ql.ddl.table.storage.AlterTableUnarchiveDesc; -import org.apache.hadoop.hive.ql.ddl.view.AlterMaterializedViewRewriteDesc; -import org.apache.hadoop.hive.ql.ddl.view.DropMaterializedViewDesc; -import org.apache.hadoop.hive.ql.ddl.view.DropViewDesc; -import org.apache.hadoop.hive.ql.ddl.view.MaterializedViewUpdateDesc; import org.apache.hadoop.hive.ql.exec.ArchiveUtils; import org.apache.hadoop.hive.ql.exec.ColumnStatsUpdateTask; import org.apache.hadoop.hive.ql.exec.FunctionRegistry; @@ -404,12 +400,6 @@ public void analyzeInternal(ASTNode input) throws SemanticException { ctx.setResFile(ctx.getLocalTmpPath()); analyzeMetastoreCheck(ast); break; - case HiveParser.TOK_DROPVIEW: - analyzeDropView(ast); - break; - case HiveParser.TOK_DROP_MATERIALIZED_VIEW: - analyzeDropMaterializedView(ast); - break; case HiveParser.TOK_ALTERVIEW: { String[] qualified = getQualifiedTableName((ASTNode) ast.getChild(0)); ast = (ASTNode) ast.getChild(1); @@ -426,16 +416,6 @@ public void analyzeInternal(ASTNode input) throws SemanticException { } break; } - case HiveParser.TOK_ALTER_MATERIALIZED_VIEW: { - ast = (ASTNode) input.getChild(1); - String[] qualified = getQualifiedTableName((ASTNode) input.getChild(0)); - String tableName = getDotName(qualified); - - if (ast.getType() == HiveParser.TOK_ALTER_MATERIALIZED_VIEW_REWRITE) { - analyzeAlterMaterializedViewRewrite(tableName, ast); - } - break; - } case HiveParser.TOK_SHOWPARTITIONS: ctx.setResFile(ctx.getLocalTmpPath()); analyzeShowPartitions(ast); @@ -612,36 +592,6 @@ private void analyzeDropTable(ASTNode ast) throws SemanticException { rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), dropTableDesc))); } - private void analyzeDropView(ASTNode ast) throws SemanticException { - String viewName = 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 view = getTable(viewName, throwException); - if (view != null) { - inputs.add(new ReadEntity(view)); - outputs.add(new WriteEntity(view, WriteEntity.WriteType.DDL_EXCLUSIVE)); - } - - DropViewDesc dropViewDesc = new DropViewDesc(viewName, ifExists); - rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), dropViewDesc))); - } - - private void analyzeDropMaterializedView(ASTNode ast) throws SemanticException { - String viewName = 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 materializedView = getTable(viewName, throwException); - if (materializedView != null) { - inputs.add(new ReadEntity(materializedView)); - outputs.add(new WriteEntity(materializedView, WriteEntity.WriteType.DDL_EXCLUSIVE)); - } - - DropMaterializedViewDesc dropMaterializedViewDesc = new DropMaterializedViewDesc(viewName, ifExists); - rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), dropMaterializedViewDesc))); - } - private void analyzeTruncateTable(ASTNode ast) throws SemanticException { ASTNode root = (ASTNode) ast.getChild(0); // TOK_TABLE_PARTITION String tableName = getUnescapedName((ASTNode) root.getChild(0)); @@ -3237,60 +3187,4 @@ private void validateSkewedLocationString(String newLocation) throws SemanticExc throw new SemanticException(e); } } - - private void analyzeAlterMaterializedViewRewrite(String fqMvName, ASTNode ast) throws SemanticException { - // Value for the flag - boolean enableFlag; - switch (ast.getChild(0).getType()) { - case HiveParser.TOK_REWRITE_ENABLED: - enableFlag = true; - break; - case HiveParser.TOK_REWRITE_DISABLED: - enableFlag = false; - break; - default: - throw new SemanticException("Invalid alter materialized view expression"); - } - - AlterMaterializedViewRewriteDesc alterMVRewriteDesc = new AlterMaterializedViewRewriteDesc(fqMvName, enableFlag); - - // It can be fully qualified name or use default database - Table materializedViewTable = getTable(fqMvName, true); - - // One last test: if we are enabling the rewrite, we need to check that query - // only uses transactional (MM and ACID) tables - if (enableFlag) { - for (String tableName : materializedViewTable.getCreationMetadata().getTablesUsed()) { - Table table = getTable(tableName, true); - if (!AcidUtils.isTransactionalTable(table)) { - throw new SemanticException("Automatic rewriting for materialized view cannot " - + "be enabled if the materialized view uses non-transactional tables"); - } - } - } - - if (AcidUtils.isTransactionalTable(materializedViewTable)) { - setAcidDdlDesc(alterMVRewriteDesc); - } - - inputs.add(new ReadEntity(materializedViewTable)); - outputs.add(new WriteEntity(materializedViewTable, WriteEntity.WriteType.DDL_EXCLUSIVE)); - - // Create task for alterMVRewriteDesc - DDLWork work = new DDLWork(getInputs(), getOutputs(), alterMVRewriteDesc); - Task targetTask = TaskFactory.get(work); - - // Create task to update rewrite flag as dependant of previous one - String tableName = alterMVRewriteDesc.getMaterializedViewName(); - boolean retrieveAndInclude = alterMVRewriteDesc.isRewriteEnable(); - boolean disableRewrite = !alterMVRewriteDesc.isRewriteEnable(); - MaterializedViewUpdateDesc materializedViewUpdateDesc = - new MaterializedViewUpdateDesc(tableName, retrieveAndInclude, disableRewrite, false); - DDLWork ddlWork = new DDLWork(getInputs(), getOutputs(), materializedViewUpdateDesc); - targetTask.addDependentTask(TaskFactory.get(ddlWork, conf)); - - // Add root task - rootTasks.add(targetTask); - } - } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g index d9ee40b42ea8..bb23a4e076d0 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g @@ -1182,8 +1182,7 @@ alterStatement @after { popMsg(state); } : KW_ALTER KW_TABLE tableName alterTableStatementSuffix -> ^(TOK_ALTERTABLE tableName alterTableStatementSuffix) | KW_ALTER KW_VIEW tableName KW_AS? alterViewStatementSuffix -> ^(TOK_ALTERVIEW tableName alterViewStatementSuffix) - | KW_ALTER KW_MATERIALIZED KW_VIEW tableName alterMaterializedViewStatementSuffix - -> ^(TOK_ALTER_MATERIALIZED_VIEW tableName alterMaterializedViewStatementSuffix) + | KW_ALTER KW_MATERIALIZED KW_VIEW tableNameTree=tableName alterMaterializedViewStatementSuffix[$tableNameTree.tree] -> alterMaterializedViewStatementSuffix | KW_ALTER (KW_DATABASE|KW_SCHEMA) alterDatabaseStatementSuffix -> alterDatabaseStatementSuffix ; @@ -1243,11 +1242,24 @@ alterViewStatementSuffix | selectStatementWithCTE ; -alterMaterializedViewStatementSuffix +alterMaterializedViewStatementSuffix[CommonTree tableNameTree] @init { pushMsg("alter materialized view statement", state); } @after { popMsg(state); } - : alterMaterializedViewSuffixRewrite - | alterMaterializedViewSuffixRebuild + : alterMaterializedViewSuffixRewrite[tableNameTree] + | alterMaterializedViewSuffixRebuild[tableNameTree] + ; + +alterMaterializedViewSuffixRewrite[CommonTree tableNameTree] +@init { pushMsg("alter materialized view rewrite statement", state); } +@after { popMsg(state); } + : (mvRewriteFlag=rewriteEnabled | mvRewriteFlag=rewriteDisabled) + -> ^(TOK_ALTER_MATERIALIZED_VIEW_REWRITE {$tableNameTree} $mvRewriteFlag) + ; + +alterMaterializedViewSuffixRebuild[CommonTree tableNameTree] +@init { pushMsg("alter materialized view rebuild statement", state); } +@after { popMsg(state); } + : KW_REBUILD -> ^(TOK_ALTER_MATERIALIZED_VIEW_REBUILD {$tableNameTree}) ; alterDatabaseStatementSuffix @@ -1412,19 +1424,6 @@ alterViewSuffixProperties -> ^(TOK_ALTERVIEW_DROPPROPERTIES tableProperties ifExists?) ; -alterMaterializedViewSuffixRewrite -@init { pushMsg("alter materialized view rewrite statement", state); } -@after { popMsg(state); } - : (mvRewriteFlag=rewriteEnabled | mvRewriteFlag=rewriteDisabled) - -> ^(TOK_ALTER_MATERIALIZED_VIEW_REWRITE $mvRewriteFlag) - ; - -alterMaterializedViewSuffixRebuild -@init { pushMsg("alter materialized view rebuild statement", state); } -@after { popMsg(state); } - : KW_REBUILD -> ^(TOK_ALTER_MATERIALIZED_VIEW_REBUILD) - ; - alterStatementSuffixSerdeProperties[boolean partition] @init { pushMsg("alter serdes statement", state); } @after { popMsg(state); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java index 24f593e5875b..5f5d7e2ea46f 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java @@ -24,8 +24,8 @@ 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.view.CreateViewDesc; -import org.apache.hadoop.hive.ql.ddl.view.MaterializedViewUpdateDesc; +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; import org.apache.hadoop.hive.ql.exec.FetchTask; import org.apache.hadoop.hive.ql.exec.GroupByOperator; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java index dc84c98d2659..9f5c55174a3d 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java @@ -31,7 +31,7 @@ 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.view.CreateViewDesc; +import org.apache.hadoop.hive.ql.ddl.view.create.CreateViewDesc; import org.apache.hadoop.hive.ql.metadata.Table; /** diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index 161ea8e844cf..281025ff6789 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -110,8 +110,8 @@ import org.apache.hadoop.hive.ql.ddl.table.creation.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.CreateViewDesc; -import org.apache.hadoop.hive.ql.ddl.view.MaterializedViewUpdateDesc; +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; import org.apache.hadoop.hive.ql.exec.ArchiveUtils; import org.apache.hadoop.hive.ql.exec.ColumnInfo; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java index 45dec5a8e304..da551b03467c 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java @@ -105,25 +105,7 @@ private static BaseSemanticAnalyzer getInternal(QueryState queryState, ASTNode t queryState.setCommandType(HiveOperation.ALTERVIEW_AS); return new SemanticAnalyzer(queryState); } - case HiveParser.TOK_ALTER_MATERIALIZED_VIEW: { - Tree child = tree.getChild(1); - switch (child.getType()) { - case HiveParser.TOK_ALTER_MATERIALIZED_VIEW_REWRITE: - opType = HiveOperation.operationForToken(child.getType()); - queryState.setCommandType(opType); - return new DDLSemanticAnalyzer(queryState); - case HiveParser.TOK_ALTER_MATERIALIZED_VIEW_REBUILD: - opType = HiveOperation.operationForToken(child.getType()); - queryState.setCommandType(opType); - return new MaterializedViewRebuildSemanticAnalyzer(queryState); - } - // Operation not recognized, set to null and let upper level handle this case - queryState.setCommandType(null); - return new DDLSemanticAnalyzer(queryState); - } case HiveParser.TOK_DROPTABLE: - case HiveParser.TOK_DROPVIEW: - case HiveParser.TOK_DROP_MATERIALIZED_VIEW: case HiveParser.TOK_DESCTABLE: case HiveParser.TOK_MSCK: case HiveParser.TOK_SHOWTABLES: diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java index 290d0baa7983..cdd212cd34ec 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java @@ -36,9 +36,9 @@ 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.view.AlterMaterializedViewRewriteDesc; -import org.apache.hadoop.hive.ql.ddl.view.CreateViewDesc; -import org.apache.hadoop.hive.ql.ddl.view.MaterializedViewUpdateDesc; +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; import org.apache.hadoop.hive.ql.exec.FetchTask; import org.apache.hadoop.hive.ql.exec.FileSinkOperator; import org.apache.hadoop.hive.ql.exec.MoveTask; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java index 847d41331b93..09d8089c5c03 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java @@ -32,7 +32,7 @@ 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.view.CreateViewDesc; +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; import org.apache.hadoop.hive.ql.exec.Utilities; diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java index 7e5e72a29375..26568ef003bc 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/LoadFileDesc.java @@ -22,7 +22,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.ql.ddl.table.creation.CreateTableDesc; -import org.apache.hadoop.hive.ql.ddl.view.CreateViewDesc; +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 a/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java index d9f88fe73149..563d0530d1ae 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java @@ -43,7 +43,7 @@ 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.view.CreateViewDesc; +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; import org.apache.hadoop.hive.ql.exec.TableScanOperator; diff --git a/ql/src/test/results/clientnegative/masking_mv.q.out b/ql/src/test/results/clientnegative/masking_mv.q.out index eb196780c795..8e49f9602e6d 100644 --- a/ql/src/test/results/clientnegative/masking_mv.q.out +++ b/ql/src/test/results/clientnegative/masking_mv.q.out @@ -119,7 +119,7 @@ STAGE PLANS: Stage: Stage-9 Materialized View Update name: default.masking_test_view_n_mv - retrieveAndInclude: true + retrieve and include: true Stage: Stage-3 Merge File Operator diff --git a/ql/src/test/results/clientnegative/strict_pruning_2.q.out b/ql/src/test/results/clientnegative/strict_pruning_2.q.out index 85c16b983710..b50d411cb899 100644 --- a/ql/src/test/results/clientnegative/strict_pruning_2.q.out +++ b/ql/src/test/results/clientnegative/strict_pruning_2.q.out @@ -1 +1 @@ -FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "default.srcpart" Table "srcpart" +FAILED: SemanticException [Error 10056]: Queries against partitioned tables without a partition filter are disabled for safety reasons. If you know what you are doing, please set hive.strict.checks.no.partition.filter to false and make sure that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get errors or incorrect results if you make a mistake while using some of the unsafe features. No partition predicate for Alias "srcpart" Table "srcpart" diff --git a/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out b/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out index 6c77549ae798..a463f429b366 100644 --- a/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out +++ b/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out @@ -271,7 +271,7 @@ STAGE PLANS: Stage: Stage-1 Materialized View Update name: default.cmv_mat_view2_n4 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: alter materialized view cmv_mat_view2_n4 enable rewrite PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE diff --git a/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out b/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out index 281113b0cfde..8e5a01337941 100644 --- a/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out +++ b/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out @@ -479,7 +479,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view2_n0 - updateCreationMetadata: true + update creation metadata: true Stage: Stage-1 Pre-Insert task diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_cluster.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_cluster.q.out index 62c578f4fb71..bd219a4370fe 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_cluster.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_cluster.q.out @@ -133,7 +133,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.cluster_mv_1 - retrieveAndInclude: true + retrieve and include: true Stage: Stage-0 Move Operator @@ -546,7 +546,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_1 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_1 REBUILD PREHOOK: type: QUERY @@ -886,7 +886,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_3 REBUILD PREHOOK: type: QUERY @@ -1141,7 +1141,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_3 REBUILD PREHOOK: type: QUERY @@ -1289,7 +1289,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_4 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_4 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out index 93a1103465aa..7e4fbbd2abef 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out @@ -283,7 +283,7 @@ STAGE PLANS: Stage: Stage-1 Materialized View Update name: default.cmv_mat_view2_n4 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: alter materialized view cmv_mat_view2_n4 enable rewrite PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out index b68d98b029e3..df3149b16e78 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out @@ -229,7 +229,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.cmv_mat_view - retrieveAndInclude: true + retrieve and include: true Stage: Stage-0 Move Operator @@ -677,7 +677,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out index cf93cff14b8f..8726792fb63a 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out @@ -478,7 +478,7 @@ STAGE PLANS: Stage: Stage-1 Materialized View Update name: default.cmv_mat_view_n5 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n5 ENABLE REWRITE PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE @@ -923,7 +923,7 @@ STAGE PLANS: Stage: Stage-6 Materialized View Update name: default.cmv_mat_view_n5 - updateCreationMetadata: true + update creation metadata: true Stage: Stage-1 Move Operator @@ -1233,7 +1233,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n5 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n5 REBUILD PREHOOK: type: QUERY @@ -1520,7 +1520,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n5 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n5 REBUILD PREHOOK: type: QUERY @@ -1900,7 +1900,7 @@ STAGE PLANS: Stage: Stage-6 Materialized View Update name: default.cmv_mat_view_n5 - updateCreationMetadata: true + update creation metadata: true Stage: Stage-1 Move Operator diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out index 1e59666f296d..99faa204fb11 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out @@ -346,7 +346,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n6 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n6 REBUILD PREHOOK: type: QUERY @@ -618,7 +618,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n6 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n6 REBUILD PREHOOK: type: QUERY @@ -846,7 +846,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n6 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n6 REBUILD PREHOOK: type: QUERY @@ -1078,7 +1078,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n6 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n6 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out index 62b74da7b296..5759c3890cc5 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out @@ -158,7 +158,7 @@ STAGE PLANS: Stage: Stage-1 Materialized View Update name: default.cmv_mat_view2 - disableRewrite: true + disable rewrite: true PREHOOK: query: alter materialized view cmv_mat_view2 disable rewrite PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE @@ -308,7 +308,7 @@ STAGE PLANS: Stage: Stage-1 Materialized View Update name: default.cmv_mat_view2 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: alter materialized view cmv_mat_view2 enable rewrite PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out index e918e2e51628..25b85b4d8d6a 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out @@ -229,7 +229,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.cmv_mat_view_n1 - retrieveAndInclude: true + retrieve and include: true Stage: Stage-0 Move Operator @@ -677,7 +677,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n1 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n1 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out index 5f7c4f6b3fdf..28fa08c53fee 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out @@ -478,7 +478,7 @@ STAGE PLANS: Stage: Stage-1 Materialized View Update name: default.cmv_mat_view_n3 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n3 ENABLE REWRITE PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE @@ -801,7 +801,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cmv_mat_view_n3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cmv_mat_view_n3 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_distribute_sort.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_distribute_sort.q.out index 56acb6a7effc..0bd2358a4769 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_distribute_sort.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_distribute_sort.q.out @@ -133,7 +133,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.distribute_mv_1 - retrieveAndInclude: true + retrieve and include: true Stage: Stage-0 Move Operator @@ -409,7 +409,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.distribute_mv_2 - retrieveAndInclude: true + retrieve and include: true Stage: Stage-0 Move Operator @@ -715,7 +715,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.distribute_mv_1 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW distribute_mv_1 REBUILD PREHOOK: type: QUERY @@ -934,7 +934,7 @@ WHERE src_txn.key = src_txn_2.key Stage: Stage-5 Materialized View Update name: default.distribute_mv_3 - retrieveAndInclude: true + retrieve and include: true Stage: Stage-0 Move Operator @@ -1280,7 +1280,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.distribute_mv_3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW distribute_mv_3 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_partition_cluster.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_partition_cluster.q.out index e712f4aeec1b..bf36e700646e 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_partition_cluster.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_partition_cluster.q.out @@ -155,7 +155,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.cluster_mv_1 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: CREATE MATERIALIZED VIEW cluster_mv_1 PARTITIONED ON (partkey) CLUSTERED ON (key) AS SELECT value, key, key + 100 as partkey FROM src_txn where key > 200 and key < 250 @@ -1044,7 +1044,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_1 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_1 REBUILD PREHOOK: type: QUERY @@ -1501,7 +1501,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_3 REBUILD PREHOOK: type: QUERY @@ -1995,7 +1995,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_3 REBUILD PREHOOK: type: QUERY @@ -2309,7 +2309,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.cluster_mv_4 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW cluster_mv_4 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_partitioned.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_partitioned.q.out index 1744b104b3bf..0ae38307f9f9 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_partitioned.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_partitioned.q.out @@ -153,7 +153,7 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.partition_mv_1 - retrieveAndInclude: true + retrieve and include: true PREHOOK: query: CREATE MATERIALIZED VIEW partition_mv_1 PARTITIONED ON (key) AS SELECT value, key FROM src_txn where key > 200 and key < 250 @@ -733,7 +733,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.partition_mv_1 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW partition_mv_1 REBUILD PREHOOK: type: QUERY @@ -1107,7 +1107,7 @@ STAGE PLANS: Stage: Stage-4 Materialized View Update name: default.partition_mv_3 - updateCreationMetadata: true + update creation metadata: true PREHOOK: query: ALTER MATERIALIZED VIEW partition_mv_3 REBUILD PREHOOK: type: QUERY diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_partitioned_3.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_partitioned_3.q.out index 045380b6888b..9ce5441fdc9f 100644 --- a/ql/src/test/results/clientpositive/llap/materialized_view_partitioned_3.q.out +++ b/ql/src/test/results/clientpositive/llap/materialized_view_partitioned_3.q.out @@ -153,5 +153,5 @@ STAGE PLANS: Stage: Stage-5 Materialized View Update name: default.partition_mv_sdp - retrieveAndInclude: true + retrieve and include: true diff --git a/ql/src/test/results/clientpositive/masking_mv.q.out b/ql/src/test/results/clientpositive/masking_mv.q.out index 99146ac85423..a1f55826a90c 100644 --- a/ql/src/test/results/clientpositive/masking_mv.q.out +++ b/ql/src/test/results/clientpositive/masking_mv.q.out @@ -119,7 +119,7 @@ STAGE PLANS: Stage: Stage-9 Materialized View Update name: default.masking_test_view_n_mv - retrieveAndInclude: true + retrieve and include: true Stage: Stage-3 Merge File Operator @@ -793,7 +793,7 @@ STAGE PLANS: Stage: Stage-9 Materialized View Update name: default.masking_test_view_n_mv_2 - retrieveAndInclude: true + retrieve and include: true Stage: Stage-3 Merge File Operator