Skip to content

Commit a311965

Browse files
parisniyihua
andauthored
[HUDI-4763] Allow hoodie read client to choose index (apache#6506)
Co-authored-by: Y Ethan Guo <ethan.guoyihua@gmail.com>
1 parent e788eb2 commit a311965

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieReadClient.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@ public HoodieReadClient(HoodieSparkEngineContext context, String basePath, SQLCo
9292
this.sqlContextOpt = Option.of(sqlContext);
9393
}
9494

95+
/**
96+
* Initializes the {@link HoodieReadClient} with engine context, base path, SQL context and index type.
97+
*
98+
* @param context Hudi Spark engine context
99+
* @param basePath Base path of the table
100+
* @param sqlContext {@link SQLContext} instance
101+
* @param indexType Hudi index type
102+
*/
103+
public HoodieReadClient(HoodieSparkEngineContext context, String basePath, SQLContext sqlContext, HoodieIndex.IndexType indexType) {
104+
this(context, HoodieWriteConfig.newBuilder().withPath(basePath)
105+
.withIndexConfig(HoodieIndexConfig.newBuilder().withIndexType(indexType).build()).build());
106+
this.sqlContextOpt = Option.of(sqlContext);
107+
}
108+
95109
/**
96110
* @param clientConfig instance of HoodieWriteConfig
97111
*/

0 commit comments

Comments
 (0)