-
Notifications
You must be signed in to change notification settings - Fork 196
Parquet Incremental Sync #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… into the parquet table
…ds, interfacing with ConversionSource
|
I can do first review for this @the-other-tim-brown @vinishjail97 |
xtable-core/src/main/java/org/apache/xtable/parquet/ParquetDataManager.java
Outdated
Show resolved
Hide resolved
xtable-core/src/main/java/org/apache/xtable/parquet/ParquetDataManager.java
Show resolved
Hide resolved
xtable-core/src/main/java/org/apache/xtable/parquet/ParquetDataManager.java
Outdated
Show resolved
Hide resolved
xtable-core/src/main/java/org/apache/xtable/parquet/ParquetFileConfig.java
Outdated
Show resolved
Hide resolved
xtable-core/src/main/java/org/apache/xtable/parquet/ParquetDataManager.java
Outdated
Show resolved
Hide resolved
| 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); |
There was a problem hiding this comment.
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.
- 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.
- 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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
@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. |
|
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. |
|
@sapienza88 I'm adding a more detailed design and a class level structure to unblock this PR. Design Principle
Architecture 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. |
…ds using the FileStatus' modifTime attribute
…ificationTime selector
…ppend and 2) filter for sync
vinishjail97
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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?
| // write the initial table with the appended file to add into the outputPath | ||
| writer.start(); |
There was a problem hiding this comment.
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?
no, I'd rather do it from scratch |
|
@vinishjail97 @the-other-tim-brown pls check the latest changes for a review. thanks. |
…into parquet_incr_sync
…into parquet_incr_sync
Important Read
What is the purpose of the pull request
(For example: This pull request implements the sync for delta format.)
Brief change log
(for example:)
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:)