Skip to content

[HUDI-8553] Support writing record positions to log blocks from Spark SQL UPDATE and DELETE statements#12716

Closed
lokeshj1703 wants to merge 5 commits intoapache:masterfrom
lokeshj1703:HUDI-8553-sql-update-delete-positions
Closed

[HUDI-8553] Support writing record positions to log blocks from Spark SQL UPDATE and DELETE statements#12716
lokeshj1703 wants to merge 5 commits intoapache:masterfrom
lokeshj1703:HUDI-8553-sql-update-delete-positions

Conversation

@lokeshj1703
Copy link
Collaborator

Change Logs

Spark SQL UPDATE and DELETE do not write record positions to the log files. The PR aims to add the metadata in log files so that it can be used for faster merge operations.

Impact

Spark SQL UPDATE and DELETE would write record positions to the log files now and it is useful for merging records.

Risk level (write none, low medium or high below)

low

Documentation Update

NA

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@github-actions github-actions bot added the size:M PR with lines of changes in (100, 300] label Jan 27, 2025
Copy link
Contributor

@nsivabalan nsivabalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any changes in the MOR snapshot read relation. I was expecting some change there to return the right value for the row position.

is the patch not yet fully ready ?
I mean, I am not asking about tests, etc, but just from source code standpoint.

val fileId = FSUtils.getFileId(fileName.get)
Some(new HoodieRecordLocation(instantTime.get, fileId))
val recordPosition: Option[Long] = if (fetchRecordLocationFromMetaFields) {
// TODO(yihua): fix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be fixed

attributeRefs = attributeRefs :+ AttributeReference(SparkAdapterSupport.sparkAdapter.getTemporaryRowIndexColumnName(), LongType, nullable = true)()

val schema = AvroSchemaUtils.projectSchema(
convertToAvroSchema(catalogTable.tableSchema, catalogTable.tableName),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see whether we need the full table schema or not, i.e., whether getting targetAttributes or non-updated columns are enough.

@github-actions github-actions bot added size:L PR with lines of changes in (300, 1000] and removed size:M PR with lines of changes in (100, 300] labels Jan 28, 2025
@hudi-bot
Copy link
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L PR with lines of changes in (300, 1000]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants