You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2020/03/16 14:46:58 UTC

[hive] branch master updated: HIVE-22970: Add a qoption to enable tests to use transactional mode (Zoltan Haindrich reviewed by Peter Vary)

This is an automated email from the ASF dual-hosted git repository.

kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 5112a9e  HIVE-22970: Add a qoption to enable tests to use transactional mode (Zoltan Haindrich reviewed by Peter Vary)
5112a9e is described below

commit 5112a9eaaa292b1f493a125b9d082db468f472a9
Author: Zoltan Haindrich <ki...@rxd.hu>
AuthorDate: Mon Mar 16 14:33:04 2020 +0000

    HIVE-22970: Add a qoption to enable tests to use transactional mode (Zoltan Haindrich reviewed by Peter Vary)
    
    Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>
---
 .../java/org/apache/hadoop/hive/ql/QTestUtil.java  |  2 +
 .../hadoop/hive/ql/qoption/QTestTransactional.java | 57 ++++++++++++++++++++++
 .../queries/clientpositive/schq_materialized.q     |  5 +-
 .../clientpositive/llap/schq_materialized.q.out    |  2 +-
 4 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
index 09df750..ffc0b2f 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
@@ -79,6 +79,7 @@ import org.apache.hadoop.hive.ql.qoption.QTestAuthorizerHandler;
 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 @@ public class QTestUtil {
     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 a/itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestTransactional.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestTransactional.java
new file mode 100644
index 0000000..463cc73
--- /dev/null
+++ b/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 a/ql/src/test/queries/clientpositive/schq_materialized.q b/ql/src/test/queries/clientpositive/schq_materialized.q
index 9848f9f..7242f3e 100644
--- a/ql/src/test/queries/clientpositive/schq_materialized.q
+++ b/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 materialized view if exists mv1;
 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 a/ql/src/test/results/clientpositive/llap/schq_materialized.q.out b/ql/src/test/results/clientpositive/llap/schq_materialized.q.out
index 194a1b3..ff86bb5 100644
--- a/ql/src/test/results/clientpositive/llap/schq_materialized.q.out
+++ b/ql/src/test/results/clientpositive/llap/schq_materialized.q.out
@@ -290,4 +290,4 @@ POSTHOOK: query: select state,error_message from sys.scheduled_executions
 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