kasakrisz commented on a change in pull request #2088:
URL: https://github.com/apache/hive/pull/2088#discussion_r599398434



##########
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestMaterializedViewRebuild.java
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.txn.compactor;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.hadoop.hive.metastore.api.CompactionType;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static 
org.apache.hadoop.hive.ql.txn.compactor.TestCompactor.executeStatementOnDriver;
+import static 
org.apache.hadoop.hive.ql.txn.compactor.TestCompactor.execSelectAndDumpData;
+import static 
org.apache.hadoop.hive.ql.txn.compactor.TestCompactor.executeStatementOnDriverSiletnly;
+
+public class TestMaterializedViewRebuild extends CompactorOnTezTest {
+
+  private static final String TABLE1 = "t1";
+  private static final String MV1 = "mat1";
+
+  private static final List<String> FULL_REBUILD_PLAN = Arrays.asList(
+      "CBO PLAN:",
+      "HiveProject(a=[$0], b=[$1], c=[$2])",
+      "  HiveFilter(condition=[OR(IS NULL($0), >($0, 0))])",
+      "    HiveTableScan(table=[[default, t1]], table:alias=[t1])",
+      ""
+  );
+
+  private static final List<String> INCREMENTAL_REBUILD_PLAN = Arrays.asList(
+      "CBO PLAN:",
+      "HiveProject(a=[$0], b=[$1], c=[$2])",
+      "  HiveFilter(condition=[AND(<(2, $5.writeid), OR(>($0, 0), IS 
NULL($0)))])",
+      "    HiveTableScan(table=[[default, t1]], table:alias=[t1])",
+      ""
+  );
+
+  private static final List<String> EXPECTED_RESULT = Arrays.asList(
+      "1\tone\t1.1",
+      "2\ttwo\t2.2",
+      "3\tthree\t3.3",
+      "NULL\tNULL\tNULL"
+  );
+
+
+  @Override
+  public void setup() throws Exception {
+    super.setup();
+
+    executeStatementOnDriver("create table " + TABLE1 + "(a int, b 
varchar(128), c float) stored as orc TBLPROPERTIES ('transactional'='true')", 
driver);
+    executeStatementOnDriver("insert into " + TABLE1 + "(a,b, c) values (1, 
'one', 1.1), (2, 'two', 2.2), (NULL, NULL, NULL)", driver);
+    executeStatementOnDriver("create materialized view " + MV1 + " stored as 
orc TBLPROPERTIES ('transactional'='true') as " +
+        "select a,b,c from " + TABLE1 + " where a > 0 or a is null", driver);
+  }
+
+  @Override
+  public void tearDown() {
+    executeStatementOnDriverSiletnly("drop materialized view " + MV1, driver);

Review comment:
       fixed.




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to