yihua commented on code in PR #13529:
URL: https://github.com/apache/hudi/pull/13529#discussion_r2193545557
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DefaultSource.scala:
##########
@@ -338,24 +338,34 @@ object DefaultSource {
val writeTableVersion =
Integer.parseInt(parameters(INCREMENTAL_READ_TABLE_VERSION.key))
if (writeTableVersion >= HoodieTableVersion.EIGHT.versionCode())
{
if (useNewParquetFileFormat) {
- new HoodieCopyOnWriteIncrementalHadoopFsRelationFactory(
- sqlContext, metaClient, parameters, userSchema,
isBootstrappedTable).build()
+ new HoodieCopyOnWriteIncrementalHadoopFsRelationFactoryV2(
Review Comment:
nit: there is duplicate code in `case (COPY_ON_WRITE,
QUERY_TYPE_INCREMENTAL_OPT_VAL, _)` and `case (MERGE_ON_READ,
QUERY_TYPE_INCREMENTAL_OPT_VAL, _)` which was somehow not addressed in the
original PR adding this part of logic. We can extract the common logic to
simplify it like this:
```
case (COPY_ON_WRITE, QUERY_TYPE_INCREMENTAL_OPT_VAL, _) =>
val tableVersion = if
(SparkConfigUtils.containsConfigProperty(parameters,
INCREMENTAL_READ_TABLE_VERSION) {
Integer.parseInt(parameters(INCREMENTAL_READ_TABLE_VERSION.key))
} else {
metaClient.getTableConfig.getTableVersion.versionCode()
}
if (tableVersion >= HoodieTableVersion.EIGHT.versionCode()) {
if (useNewParquetFileFormat) {
new HoodieCopyOnWriteIncrementalHadoopFsRelationFactory(
sqlContext, metaClient, parameters, userSchema,
isBootstrappedTable).build()
} else {
new IncrementalRelationV2(sqlContext, parameters,
userSchema, metaClient, RangeType.CLOSED_CLOSED)
}
} else {
if (useNewParquetFileFormat) {
new HoodieCopyOnWriteIncrementalHadoopFsRelationFactoryV1(
sqlContext, metaClient, parameters, userSchema,
isBootstrappedTable).build()
} else {
new IncrementalRelationV1(sqlContext, parameters,
userSchema, metaClient)
}
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]