umehrot2 commented on a change in pull request #1416: [HUDI-717] Fixed usage of 
HiveDriver for DDL statements for Hive 2.x
URL: https://github.com/apache/incubator-hudi/pull/1416#discussion_r397012179
 
 

 ##########
 File path: 
hudi-hive-sync/src/test/java/org/apache/hudi/hive/TestHiveSyncTool.java
 ##########
 @@ -363,4 +404,51 @@ public void testMultiPartitionKeySync() throws Exception {
     assertEquals("The last commit that was sycned should be updated in the 
TBLPROPERTIES", commitTime,
         hiveClient.getLastCommitTimeSynced(hiveSyncConfig.tableName).get());
   }
+
+  @Test
+  public void testSchemeFromMOR() throws Exception {
+    TestUtil.hiveSyncConfig.useJdbc = this.useJdbc;
+    String commitTime = "100";
+    String snapshotTableName = TestUtil.hiveSyncConfig.tableName + 
HiveSyncTool.SUFFIX_SNAPSHOT_TABLE;
+    TestUtil.createMORTable(commitTime, "", 5, false);
+    HoodieHiveClient hiveClientRT =
+        new HoodieHiveClient(TestUtil.hiveSyncConfig, TestUtil.getHiveConf(), 
TestUtil.fileSystem);
+
+    assertFalse("Table " + TestUtil.hiveSyncConfig.tableName + 
HiveSyncTool.SUFFIX_SNAPSHOT_TABLE
+        + " should not exist initially", 
hiveClientRT.doesTableExist(snapshotTableName));
+
+    // Lets do the sync
+    HiveSyncTool tool = new HiveSyncTool(TestUtil.hiveSyncConfig, 
TestUtil.getHiveConf(), TestUtil.fileSystem);
+    tool.syncHoodieTable();
+
+    assertTrue("Table " + TestUtil.hiveSyncConfig.tableName + 
HiveSyncTool.SUFFIX_SNAPSHOT_TABLE
+        + " should exist after sync completes", 
hiveClientRT.doesTableExist(snapshotTableName));
+
+    // Schema being read from compacted base files
+    assertEquals("Hive Schema should match the table schema + partition 
field", hiveClientRT.getTableSchema(snapshotTableName).size(),
+        SchemaTestUtil.getSimpleSchema().getFields().size() + 1);
 
 Review comment:
   Is this the only reason to add this test, so that schema is read from base 
file ? Otherwise this seems exactly like `testSyncMergeOnRead` ? I guess I am 
also trying to understand how this test relates to the change you are making in 
this review.
   
   On that note name of the test `testSchemeFromMOR` can probably be changed to 
something more meaningful to reflect what this test is trying to achieve 
differently.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to