prashantwason 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_r400429131
########## 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: Yes, wanted to add tests for schema reading from both base and and log files. I guess the first (reading schema from base files) is already covered by other unit tests. >> I guess I am also trying to understand how this test relates to the change you are making in this review. The changes made are specifically tested in testBasicSync. I added more tests to this unit test. I have renamed the test to testReadSchemaForMOR ---------------------------------------------------------------- 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