You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/05/15 10:46:32 UTC

[GitHub] [hive] miklosgergely commented on a change in pull request #1018: HIVE-23460 qdisabled

miklosgergely commented on a change in pull request #1018:
URL: https://github.com/apache/hive/pull/1018#discussion_r425719693



##########
File path: itests/util/src/main/java/org/apache/hadoop/hive/ql/qoption/QTestDisabledHandler.java
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.junit.Assume;
+
+import com.google.common.base.Strings;
+
+/**
+ * QTest disabled directive handler
+ *
+ * Example:
+ * --! qt:disabled:reason
+ *
+ */
+public class QTestDisabledHandler implements QTestOptionHandler {
+
+  private String message;
+
+  @Override
+  public void processArguments(String arguments) {
+    message = arguments;
+    if (Strings.isNullOrEmpty(message)) {
+      throw new RuntimeException("you have to give a reason why it was ignored");
+    }
+  }
+
+  @Override
+  public void beforeTest(QTestUtil qt) throws Exception {
+    Assume.assumeTrue(message, (message == null));

Review comment:
       Instead of throwing an exception, and catching it later I'd suggest to flip a new boolean "skipped" in QTestUtil, then read it from there. Having a q test disabled is not an exceptional thing, and considering every AssumptionViolatedException as a sign of skipping can lead to unexpected situation in case of other assume* commands are failing.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org