sankarh commented on a change in pull request #1370:
URL: https://github.com/apache/hive/pull/1370#discussion_r467461932



##########
File path: ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java
##########
@@ -566,4 +567,28 @@ public void testMMExportAborted() throws Exception {
         TestTxnCommands2.stringifyValues(data), rs);
 
   }
-}
+
+  @Test public void testExportPartitionedOrcWithOutColumnStats() throws 
Exception {
+
+    runStatementOnDriver("drop table if exists T");
+    runStatementOnDriver("drop table if exists Tstage");
+    runStatementOnDriver("create table T (a int, b int) partitioned by (p int) 
stored"
+        + " as orc tblproperties('transactional'='true')");
+    //Tstage is the target table
+    runStatementOnDriver("create table Tstage (a int, b int) partitioned by (p 
int) stored"
+        + " as orc tblproperties('transactional'='true')");
+    //this creates an ORC data file with correct schema under table root
+    runStatementOnDriver("insert into Tstage 
values(1,2,10),(3,4,11),(5,6,12)");
+    final int[][] rows = { { 3 } };
+    //now we have an archive with 3 partitions
+    runStatementOnDriver("export table Tstage to '" + getWarehouseDir() + 
"/1'");

Review comment:
       Check the COLUMN_STATS_ACCURATE property is true on source table and 
partition before and after export operation to confirm we don't overwrite 
anything in their metadata.

##########
File path: ql/src/test/org/apache/hadoop/hive/ql/TestTxnExIm.java
##########
@@ -566,4 +567,28 @@ public void testMMExportAborted() throws Exception {
         TestTxnCommands2.stringifyValues(data), rs);
 
   }
-}
+
+  @Test public void testExportPartitionedOrcWithOutColumnStats() throws 
Exception {
+
+    runStatementOnDriver("drop table if exists T");
+    runStatementOnDriver("drop table if exists Tstage");
+    runStatementOnDriver("create table T (a int, b int) partitioned by (p int) 
stored"
+        + " as orc tblproperties('transactional'='true')");
+    //Tstage is the target table
+    runStatementOnDriver("create table Tstage (a int, b int) partitioned by (p 
int) stored"
+        + " as orc tblproperties('transactional'='true')");
+    //this creates an ORC data file with correct schema under table root
+    runStatementOnDriver("insert into Tstage 
values(1,2,10),(3,4,11),(5,6,12)");
+    final int[][] rows = { { 3 } };
+    //now we have an archive with 3 partitions
+    runStatementOnDriver("export table Tstage to '" + getWarehouseDir() + 
"/1'");
+
+    //load T
+    runStatementOnDriver("import table T from '" + getWarehouseDir() + "/1'");
+    List<String> rsProperties = runStatementOnDriver("show tblproperties T");

Review comment:
       Can we also check the partition properties?




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