This is an automated email from the ASF dual-hosted git repository.

danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f21c2d9d9b [MINOR] Support MOR table type for 
HoodieJavaWriteClientExample (#11700)
9f21c2d9d9b is described below

commit 9f21c2d9d9b6d2ca48cf79a433a5eed9500c8045
Author: TheR1sing3un <[email protected]>
AuthorDate: Wed Jul 31 18:38:21 2024 +0800

    [MINOR] Support MOR table type for HoodieJavaWriteClientExample (#11700)
    
    1. Support MOR table type for HoodieJavaWriteClientExample
    2. Typo Fix
    
    Signed-off-by: ther1sing3un <[email protected]>
---
 .../apache/hudi/common/table/HoodieTableMetaClient.java |  2 +-
 .../examples/java/HoodieJavaWriteClientExample.java     | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git 
a/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java
 
b/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java
index 5da1c7c39c6..a61bb41aab5 100644
--- 
a/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java
+++ 
b/hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java
@@ -641,7 +641,7 @@ public class HoodieTableMetaClient implements Serializable {
     }
 
 
-    // Create bootstrap index by partition folder if it does not exist
+    // Create bootstrap index by file-id folder if it does not exist
     final StoragePath bootstrap_index_folder_by_fileids =
         new StoragePath(basePath, 
HoodieTableMetaClient.BOOTSTRAP_INDEX_BY_FILE_ID_FOLDER_PATH);
     if (!storage.exists(bootstrap_index_folder_by_fileids)) {
diff --git 
a/hudi-examples/hudi-examples-java/src/main/java/org/apache/hudi/examples/java/HoodieJavaWriteClientExample.java
 
b/hudi-examples/hudi-examples-java/src/main/java/org/apache/hudi/examples/java/HoodieJavaWriteClientExample.java
index 7607542098d..84bd12c4fc7 100644
--- 
a/hudi-examples/hudi-examples-java/src/main/java/org/apache/hudi/examples/java/HoodieJavaWriteClientExample.java
+++ 
b/hudi-examples/hudi-examples-java/src/main/java/org/apache/hudi/examples/java/HoodieJavaWriteClientExample.java
@@ -47,9 +47,10 @@ import java.util.stream.Collectors;
 /**
  * Simple examples of #{@link HoodieJavaWriteClient}.
  *
- * Usage: HoodieJavaWriteClientExample <tablePath> <tableName>
+ * Usage: HoodieJavaWriteClientExample <tablePath> <tableName> <tableType>
  * <tablePath> and <tableName> describe root path of hudi and table name
- * for example, `HoodieJavaWriteClientExample file:///tmp/hoodie/sample-table 
hoodie_rt`
+ * <tableType> describe table's type, now support mor and cow, default value 
is cow
+ * for example, `HoodieJavaWriteClientExample file:///tmp/hoodie/sample-table 
hoodie_rt mor`
  */
 public class HoodieJavaWriteClientExample {
 
@@ -57,13 +58,21 @@ public class HoodieJavaWriteClientExample {
 
   private static String tableType = HoodieTableType.COPY_ON_WRITE.name();
 
+  private static final String morStr = "mor";
+
   public static void main(String[] args) throws Exception {
-    if (args.length < 2) {
-      System.err.println("Usage: HoodieJavaWriteClientExample <tablePath> 
<tableName>");
+    if (args.length < 3) {
+      System.err.println("Usage: HoodieJavaWriteClientExample <tablePath> 
<tableName> <tableType: [cow|mor]>");
       System.exit(1);
     }
     String tablePath = args[0];
     String tableName = args[1];
+    String tableTypeStr = args[2];
+    if (tableTypeStr != null && tableTypeStr.equals(morStr)) {
+      tableType = HoodieTableType.MERGE_ON_READ.name();
+    }
+
+    LOG.info("Start JavaWriteClient example with tablePath: " + tablePath + ", 
tableName: " + tableName + ", tableType: " + tableType);
 
     // Generator of some records to be loaded in.
     HoodieExampleDataGenerator<HoodieAvroPayload> dataGen = new 
HoodieExampleDataGenerator<>();

Reply via email to