diff --git itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java index 09df750..ffc0b2f 100644 --- itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java +++ itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java @@ -79,6 +79,7 @@ import org.apache.hadoop.hive.ql.qoption.QTestOptionDispatcher; import org.apache.hadoop.hive.ql.qoption.QTestReplaceHandler; import org.apache.hadoop.hive.ql.qoption.QTestSysDbHandler; +import org.apache.hadoop.hive.ql.qoption.QTestTransactional; import org.apache.hadoop.hive.ql.scheduled.QTestScheduledQueryCleaner; import org.apache.hadoop.hive.ql.scheduled.QTestScheduledQueryServiceProvider; import org.apache.hadoop.hive.ql.session.SessionState; @@ -214,6 +215,7 @@ dispatcher.register("dataset", datasetHandler); dispatcher.register("replace", replaceHandler); dispatcher.register("sysdb", new QTestSysDbHandler()); + dispatcher.register("transactional", new QTestTransactional()); dispatcher.register("scheduledqueryservice", new QTestScheduledQueryServiceProvider(conf)); dispatcher.register("scheduledquerycleaner", new QTestScheduledQueryCleaner()); dispatcher.register("authorizer", new QTestAuthorizerHandler()); diff --git itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestTransactional.java itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestTransactional.java new file mode 100644 index 0000000..463cc73 --- /dev/null +++ itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestTransactional.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.qoption; + +import org.apache.hadoop.hive.ql.QTestUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * QTest transactional directive handler + * + * Enables transactional for the test. + * Could also make it for other QOption-s. + * + * Example: + * --! qt:transactional + * + */ +public class QTestTransactional implements QTestOptionHandler { + private static final Logger LOG = LoggerFactory.getLogger(QTestTransactional.class.getName()); + private boolean enabled; + + @Override + public void processArguments(String arguments) { + enabled = true; + } + + @Override + public void beforeTest(QTestUtil qt) throws Exception { + if (enabled) { + qt.getConf().set("hive.support.concurrency", "true"); + qt.getConf().set("hive.txn.manager", "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager"); + } + } + + @Override + public void afterTest(QTestUtil qt) throws Exception { + enabled = false; + } + +} diff --git ql/src/test/queries/clientpositive/schq_materialized.q ql/src/test/queries/clientpositive/schq_materialized.q index 9848f9f..7242f3e 100644 --- ql/src/test/queries/clientpositive/schq_materialized.q +++ ql/src/test/queries/clientpositive/schq_materialized.q @@ -1,5 +1,6 @@ --! qt:authorizer --! qt:scheduledqueryservice +--! qt:transactional --! qt:sysdb set user.name=hive_admin_user; @@ -9,10 +10,6 @@ drop table if exists emps; drop table if exists depts; -set hive.support.concurrency=true; -set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager; -set hive.strict.checks.cartesian.product=false; -set hive.stats.fetch.column.stats=true; set hive.materializedview.rewriting=true; -- create some tables diff --git ql/src/test/results/clientpositive/llap/schq_materialized.q.out ql/src/test/results/clientpositive/llap/schq_materialized.q.out index 194a1b3..ff86bb5 100644 --- ql/src/test/results/clientpositive/llap/schq_materialized.q.out +++ ql/src/test/results/clientpositive/llap/schq_materialized.q.out @@ -290,4 +290,4 @@ POSTHOOK: type: QUERY POSTHOOK: Input: sys@scheduled_executions #### A masked pattern was here #### -FAILED FAILED: SemanticException [Error 10265]: This command is not allowed on an ACID table default.emps with a non-ACID transaction manager. Failed command: /* schedule: d */alter materialized view `default`.`mv1` rebuild +FINISHED NULL