-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[FLINK-29291] Change DataFileWriter into a factory to create writers #298
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
Conversation
| // adding one record then remove one record, but after merging this record will not | ||
| // appear in lsm file. This is OK because we can also skip this changelog. | ||
| DataFileMeta fileMeta = writer.result(); | ||
| if (fileMeta != null) { |
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.
if (fileMeta == null), extraFiles is not be deleted?
| RowType valueType, | ||
| BulkWriter.Factory<RowData> writerFactory, | ||
| @Nullable FileStatsExtractor fileStatsExtractor, | ||
| FileStatsExtractor fileStatsExtractor, |
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 remove nullable?
|
|
||
| public void delete(DataFileMeta file) { | ||
| delete(file.fileName()); | ||
| public SingleFileWriter<KeyValue, Void> createExtraFileWriter() { |
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.
createChangelogFileWriter? we may have more extra files in future.
| DataFileMeta fileMeta = writer.result(); | ||
| if (fileMeta != null) { | ||
| if (fileMeta == null) { | ||
| for (String extraFile : extraFiles) { |
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.
Can we add a test for this? Maybe in ChangelogWithKeyFileStoreTableTest.testStreamingChangelog
JingsongLi
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.
Looks good to me!
Currently DataFileWriter exposes write method for data files and extra files.
However, as the number of patterns to write files is increasing (for example, we'd like to write some records into a data file, then write some other records into an extra files when producing changelogs from full compaction) we'll have to keep adding methods to DataFileWriter if we keep the current implementation.
We'd like to refactor DataFileWriter into a factory to create writers, so that the users of writers can write however they like.