danny0405 commented on code in PR #10836:
URL: https://github.com/apache/hudi/pull/10836#discussion_r1517073079
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieDatasetBulkInsertHelper.scala:
##########
@@ -149,53 +150,53 @@ object HoodieDatasetBulkInsertHelper
arePartitionRecordsSorted: Boolean,
shouldPreserveHoodieMetadata: Boolean):
HoodieData[WriteStatus] = {
val schema = dataset.schema
- val writeStatuses =
injectSQLConf(dataset.queryExecution.toRdd.mapPartitions(iter => {
- val taskContextSupplier: TaskContextSupplier =
table.getTaskContextSupplier
- val taskPartitionId = taskContextSupplier.getPartitionIdSupplier.get
- val taskId = taskContextSupplier.getStageIdSupplier.get.toLong
- val taskEpochId = taskContextSupplier.getAttemptIdSupplier.get
+ HoodieJavaRDD.of(
+ injectSQLConf(dataset.queryExecution.toRdd.mapPartitions(iter => {
+ val taskContextSupplier: TaskContextSupplier =
table.getTaskContextSupplier
+ val taskPartitionId = taskContextSupplier.getPartitionIdSupplier.get
+ val taskId = taskContextSupplier.getStageIdSupplier.get.toLong
+ val taskEpochId = taskContextSupplier.getAttemptIdSupplier.get
- val writer = writeConfig.getIndexType match {
- case HoodieIndex.IndexType.BUCKET if
writeConfig.getBucketIndexEngineType
- == BucketIndexEngineType.CONSISTENT_HASHING =>
- new ConsistentBucketBulkInsertDataInternalWriterHelper(
- table,
- writeConfig,
- instantTime,
- taskPartitionId,
- taskId,
- taskEpochId,
- schema,
- writeConfig.populateMetaFields,
- arePartitionRecordsSorted,
- shouldPreserveHoodieMetadata)
- case _ =>
- new BulkInsertDataInternalWriterHelper(
- table,
- writeConfig,
- instantTime,
- taskPartitionId,
- taskId,
- taskEpochId,
- schema,
- writeConfig.populateMetaFields,
- arePartitionRecordsSorted,
- shouldPreserveHoodieMetadata)
- }
+ val writer = writeConfig.getIndexType match {
+ case HoodieIndex.IndexType.BUCKET if
writeConfig.getBucketIndexEngineType
+ == BucketIndexEngineType.CONSISTENT_HASHING =>
+ new ConsistentBucketBulkInsertDataInternalWriterHelper(
+ table,
+ writeConfig,
+ instantTime,
+ taskPartitionId,
+ taskId,
+ taskEpochId,
+ schema,
+ writeConfig.populateMetaFields,
+ arePartitionRecordsSorted,
+ shouldPreserveHoodieMetadata)
+ case _ =>
+ new BulkInsertDataInternalWriterHelper(
+ table,
+ writeConfig,
+ instantTime,
+ taskPartitionId,
+ taskId,
+ taskEpochId,
+ schema,
+ writeConfig.populateMetaFields,
+ arePartitionRecordsSorted,
+ shouldPreserveHoodieMetadata)
+ }
- try {
- iter.foreach(writer.write)
- } catch {
- case t: Throwable =>
- writer.abort()
- throw t
- } finally {
- writer.close()
- }
+ try {
+ iter.foreach(writer.write)
+ } catch {
+ case t: Throwable =>
+ writer.abort()
+ throw t
+ } finally {
+ writer.close()
+ }
- writer.getWriteStatuses.asScala.iterator
- }), SQLConf.get).collect()
Review Comment:
Nice catch ~
--
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]