-
Notifications
You must be signed in to change notification settings - Fork 3k
Introduce GenericAppenderFactory and GenericAppenderHelper #1340
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
f80e419 to
38e0605
Compare
| return Avro.write(outputFile) | ||
| .schema(schema) | ||
| .createWriterFunc(DataWriter::create) | ||
| .named(fileFormat.name()) |
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.
The name is usually a table name for the given schema. not fileFormat. we may need to remove this line, or set it with a reasonable table name.
| return Parquet.write(outputFile) | ||
| .schema(schema) | ||
| .createWriterFunc(GenericParquetWriter::buildWriter) | ||
| .named(fileFormat.name()) |
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.
ditto
| return ORC.write(outputFile) | ||
| .schema(schema) | ||
| .createWriterFunc(GenericOrcWriter::buildWriter) | ||
| .setAll(config) |
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.
To keep the consistent semantics, I suggest to set overwrite=true. Both flink and spark's FileAppenderFactory have enabled the overwrite.
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.
Yes, they do.
| .withPath(file.toURI().toString()) | ||
| .withMetrics(appender.metrics()) | ||
| .withFormat(format); | ||
| if (partition != 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.
We could call the withPartition(partition) directly without this nullable check, because builder will handle this inside it.
|
Thanks @JingsongLi, looks good. |
In #1293, we found lot of places use
switch case avro orc parquetto create appender, these logicals can be extract toGenericAppenderFactory.