vinothchandar commented on a change in pull request #1500: [HUDI-772] Make 
UserDefinedBulkInsertPartitioner configurable for DataSource
URL: https://github.com/apache/incubator-hudi/pull/1500#discussion_r409751557
 
 

 ##########
 File path: hudi-spark/src/test/java/DataSourceUtilsTest.java
 ##########
 @@ -59,4 +99,47 @@ public void testAvroRecordsFieldConversion() {
     assertEquals("Hudi Meetup", 
DataSourceUtils.getNestedFieldValAsString(record, "event_name", true));
     assertEquals("Hudi PMC", DataSourceUtils.getNestedFieldValAsString(record, 
"event_organizer", true));
   }
+
+  @Test
+  public void testDoWriteOperationWithoutUserDefinedBulkInsertPartitioner() 
throws IOException {
+    DataSourceUtils.doWriteOperation(hoodieWriteClient, hoodieRecords, 
"test-time",
+            DataSourceWriteOptions.BULK_INSERT_OPERATION_OPT_VAL());
+
+    verify(hoodieWriteClient, 
times(1)).bulkInsert(any(hoodieRecords.getClass()), anyString(),
+            optionCaptor.capture());
+
+    assertThat(optionCaptor.getValue(), is(equalTo(Option.empty())));
+  }
+
+  @Test (expected = IOException.class)
+  public void 
testDoWriteOperationWithNonExistUserDefinedBulkInsertPartitioner() throws 
IOException {
+    verifyAndSetHoodieWriteClient("NonExistClassName");
+
+    DataSourceUtils.doWriteOperation(hoodieWriteClient, hoodieRecords, 
"test-time",
+            DataSourceWriteOptions.BULK_INSERT_OPERATION_OPT_VAL());
+  }
+
+  @Test
+  public void testDoWriteOperationWithUserDefinedBulkInsertPartitioner() 
throws IOException {
 
 Review comment:
   I guess this wont work with an anonymous class ;/ 

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


With regards,
Apache Git Services

Reply via email to