refine: refine writer interface #741
Open
+136
−125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I'm working on writer recently and find some weaknesses of our original writer interface design:
And I realized that this custom config param cause we can't combine the write flexibility. E.g. In partition writer
So avoid this problem, we should pass the custom param when create the builder and the build interface should looks like
fn build() -> Self
In our original design, user should pass the schema to file writer builder when create them like
However, sometimes the schema is hard to determine when we create them. E.g. equality delete writer, we only know what the schema looks like util we pass the equality id and create the equality delete writer. To avoid the problem, we change
fn build() -> Self
of FileWriterBuilder tofn build(schema:SchemaRef) -> Self
. By this way, the schema of FileWriter is determined by base writer.I send this discussion as a PR to make it easier to express my idea. BTW, I applied this change and complete partition writer, delta writer in https://github.com/ZENOTME/iceberg-rust/tree/partition_writer and it looks well.
Feel free for any suggestion. cc @liurenjie1024 @Xuanwo @Fokko @c-thiel