[ 
https://issues.apache.org/jira/browse/HIVE-25792?focusedWorklogId=696405&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-696405
 ]

ASF GitHub Bot logged work on HIVE-25792:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Dec/21 07:16
            Start Date: 15/Dec/21 07:16
    Worklog Time Spent: 10m 
      Work Description: pvary commented on a change in pull request #2865:
URL: https://github.com/apache/hive/pull/2865#discussion_r769314898



##########
File path: 
ql/src/test/org/apache/hadoop/hive/ql/optimizer/calcite/TestCBOReCompilation.java
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.optimizer.calcite;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hadoop.hive.ql.DriverFactory;
+import org.apache.hadoop.hive.ql.IDriver;
+import org.apache.hadoop.hive.ql.processors.CommandProcessorException;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import org.apache.hive.testutils.HiveTestEnvSetup;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+public class TestCBOReCompilation {
+
+  @ClassRule
+  public static HiveTestEnvSetup env_setup = new HiveTestEnvSetup();
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    try (IDriver driver = createDriver()) {
+      dropTables(driver);
+      String[] cmds = {
+          // @formatter:off
+          "create table aa1 ( stf_id string)",
+          "create table bb1 ( stf_id string)",
+          "create table cc1 ( stf_id string)",
+          "create table ff1 ( x string)"
+          // @formatter:on
+      };
+      for (String cmd : cmds) {
+        driver.run(cmd);
+      }
+    }
+  }
+
+  @AfterClass
+  public static void afterClass() throws Exception {
+    try (IDriver driver = createDriver()) {
+      dropTables(driver);
+    }
+  }
+
+  public static void dropTables(IDriver driver) throws Exception {
+    String[] tables = new String[] {"aa1", "bb1", "cc1", "ff1" };
+    for (String t : tables) {
+      driver.run("drop table if exists " + t);
+    }
+  }
+
+  @Test
+  public void testReExecutedOnError() throws Exception {
+    try (IDriver driver = createDriver("ALWAYS")) {
+      String query = "explain from ff1 as a join cc1 as b " +
+          "insert overwrite table aa1 select   stf_id GROUP BY b.stf_id " +
+          "insert overwrite table bb1 select b.stf_id GROUP BY b.stf_id";
+      driver.run(query);
+    }
+  }
+
+  @Test
+  public void testFailOnError() throws Exception {
+    try (IDriver driver = createDriver("TEST")) {
+      String query = "explain from ff1 as a join cc1 as b " +
+          "insert overwrite table aa1 select   stf_id GROUP BY b.stf_id " +
+          "insert overwrite table bb1 select b.stf_id GROUP BY b.stf_id";
+      Assert.assertThrows("Plan not optimized by CBO", 
CommandProcessorException.class, () -> driver.run(query));

Review comment:
       Found other tests created by @zabetak, so no need to keep these




-- 
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.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 696405)
    Time Spent: 3.5h  (was: 3h 20m)

> Multi Insert query fails on CBO path 
> -------------------------------------
>
>                 Key: HIVE-25792
>                 URL: https://issues.apache.org/jira/browse/HIVE-25792
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Peter Vary
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> {code}
> set hive.cbo.enable=true;
> drop table if exists aa1;
> drop table if exists bb1;
> drop table if exists cc1;
> drop table if exists dd1;
> drop table if exists ee1;
> drop table if exists ff1;
> create table aa1 ( stf_id string);
> create table bb1 ( stf_id string);
> create table cc1 ( stf_id string);
> create table ff1 ( x string);
> explain
> from ff1 as a join cc1 as b 
> insert overwrite table aa1 select   stf_id GROUP BY b.stf_id
> insert overwrite table bb1 select b.stf_id GROUP BY b.stf_id
> ;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to