Skip to content

Conversation

@sapienza88
Copy link
Contributor

Important Read

  • Please ensure the GitHub issue is mentioned at the beginning of the PR

What is the purpose of the pull request

(For example: This pull request implements the sync for delta format.)

Brief change log

(for example:)

  • Fixed JSON parsing error when persisting state
  • Added unit tests for schema evolution

Verify this pull request

(Please pick either of the following options)

This pull request is a trivial rework / code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end.
  • Added TestConversionController to verify the change.
  • Manually verified the change by running a job locally.

@sapienza88 sapienza88 changed the title Parquet Incremental Sync: Given a parquet file return data from a certain modification time Parquet Incremental Sync Dec 10, 2025
@rahil-c
Copy link
Contributor

rahil-c commented Dec 15, 2025

I can do first review for this @the-other-tim-brown @vinishjail97

@vinishjail97 vinishjail97 self-requested a review December 16, 2025 08:31
Comment on lines 245 to 259
try (ParquetWriter<Group> writer =
new ParquetWriter<Group>(
outputFile,
new GroupWriteSupport(),
parquetFileConfig.getCodec(),
(int) parquetFileConfig.getRowGroupSize(),
pageSize,
pageSize, // dictionaryPageSize
true, // enableDictionary
false, // enableValidation
ParquetWriter.DEFAULT_WRITER_VERSION,
conf)) {
Group currentGroup = null;
while ((currentGroup = (Group) reader.read()) != null) {
writer.write(currentGroup);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we writing new parquet files again like this through the writer? I think there's some misunderstanding with the parquet incremental sync feature here.

Parquet Incremental Sync Requirements.

  1. You have a target table where parquet files [p1/f1.parquet, p1/f2.parquet, p2/f1.parquet] have been synced to hudi, iceberg and delta for example.
  2. In the source changes some changes have been made a new file in partition p1 was added and p2's file was deleted. The incremental sync should now sync the new changes incrementally.

@sapienza88 It's better to align on the approach first here before we push PR's. Can you add the approach for parquet incremental sync in the PR description or any google doc if possible?

Copy link
Contributor

@vinishjail97 vinishjail97 Dec 22, 2025

Choose a reason for hiding this comment

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

@sapienza88 XTable shouldn't be writing any new data or parquet files it operates at a metadata level. Can you see this comment for reference?
#550 (comment)
Fetch the parquet files that have been added since last syncInstant to retrieve the change log. We can this via the same list call and filtering files based on their creationTime is the simplest way but it's expensive

Copy link
Contributor Author

@sapienza88 sapienza88 Dec 23, 2025

Choose a reason for hiding this comment

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

@vinishjail97 thanks for the suggestion, but that isn't helping. Could you elaborate on that idea and how you could manage the metadata only for the task of retrieving data from a particular (modification) date? at the very least the current ConversionSource wasn't coded with that in mind.

@sapienza88
Copy link
Contributor Author

@vinishjail97 I added some comments on the functions so that the approach is clearer. All above suggestions were also taken into account in my last commit.

@vinishjail97
Copy link
Contributor

XTable shouldn't be writing any new data or parquet files it operators at a metadata level. Can you see this comment for reference? I had written few approaches on how to do incremental parquet sync.
#550 (comment)

@vinishjail97
Copy link
Contributor

@sapienza88 I'm adding a more detailed design and a class level structure to unblock this PR.

Design Principle
XTable operates at a metadata level only. The current PR approach of writing new Parquet files with filtered data is incorrect. XTable should:

  • Discover existing Parquet files from storage
  • Generate table format metadata (Hudi, Iceberg, Delta) for those files
  • NEVER write new Parquet files or transform data.

Architecture

  ┌────────────────────────────────────────────────────────────┐
  │                  ParquetConversionSource                   │
  │  - Uses ParquetFileDiscovery to find files                 │
  │  - Converts file metadata to InternalDataFile              │
  │  - Returns snapshots and table changes                     │
  └────────────────────────────────────────────────────────────┘
                              │
                              ▼
  ┌────────────────────────────────────────────────────────────┐
  │              ParquetFileDiscovery (new class)              │
  │  - Lists all .parquet files from filesystem                │
  │  - Filters files by modification time                      │
  │  - Returns lightweight file metadata                       │
  └────────────────────────────────────────────────────────────┘
                              │
                              ▼
  ┌────────────────────────────────────────────────────────────┐
  │            FileSystem (HDFS/S3/GCS/Azure)                  │
  │  - fs.listFiles(basePath, recursive=true)                  │
  └────────────────────────────────────────────────────────────┘

Use file modification time as commit identifier, you will be able to identify which files have been synced and which haven't been synced. The files not synced need to have metadata generated. The future functionality like making it optimized, handling deleted parquet files in storage can be handled incrementally, hoping to scope low for this PR.

Copy link
Contributor

@vinishjail97 vinishjail97 left a comment

Choose a reason for hiding this comment

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

@sapienza88 Should I push a scaffolding PR for basic functionality with incremental sync and you can take it forward from there?

return parquetFileConfig;
}
// TODO add safe guards for possible empty parquet files
// append a file (merges two files into one .parquet under a partition folder)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we merging two parquet files to one? We are not building a compaction service right?

Comment on lines 84 to 85
// write the initial table with the appended file to add into the outputPath
writer.start();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is again writing actual data?

@sapienza88
Copy link
Contributor Author

@sapienza88 Should I push a scaffolding PR for basic functionality with incremental sync and you can take it forward from there?

no, I'd rather do it from scratch

@sapienza88
Copy link
Contributor Author

@vinishjail97 @the-other-tim-brown pls check the latest changes for a review. thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants