You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by yi...@apache.org on 2022/09/10 15:52:07 UTC

[hudi] branch master updated: [HUDI-4763] Allow hoodie read client to choose index (#6506)

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

yihua 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 a311965816 [HUDI-4763] Allow hoodie read client to choose index (#6506)
a311965816 is described below

commit a311965816ece4dd88650fabf2f59fb46705bd65
Author: Nicolas Paris <ni...@riseup.net>
AuthorDate: Sat Sep 10 17:51:59 2022 +0200

    [HUDI-4763] Allow hoodie read client to choose index (#6506)
    
    Co-authored-by: Y Ethan Guo <et...@gmail.com>
---
 .../main/java/org/apache/hudi/client/HoodieReadClient.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieReadClient.java b/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieReadClient.java
index 37a78a4be5..97e54070cf 100644
--- a/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieReadClient.java
+++ b/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieReadClient.java
@@ -92,6 +92,20 @@ public class HoodieReadClient<T extends HoodieRecordPayload<T>> implements Seria
     this.sqlContextOpt = Option.of(sqlContext);
   }
 
+  /**
+   * Initializes the {@link HoodieReadClient} with engine context, base path, SQL context and index type.
+   *
+   * @param context    Hudi Spark engine context
+   * @param basePath   Base path of the table
+   * @param sqlContext {@link SQLContext} instance
+   * @param indexType  Hudi index type
+   */
+  public HoodieReadClient(HoodieSparkEngineContext context, String basePath, SQLContext sqlContext, HoodieIndex.IndexType indexType) {
+    this(context, HoodieWriteConfig.newBuilder().withPath(basePath)
+                       .withIndexConfig(HoodieIndexConfig.newBuilder().withIndexType(indexType).build()).build());
+    this.sqlContextOpt = Option.of(sqlContext);
+  }
+
   /**
    * @param clientConfig instance of HoodieWriteConfig
    */