-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-24359][table-runtime] Use ResolvedSchema in AbstractFileSystemTable #17350
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
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 98fac3d (Fri Sep 24 10:58:43 UTC 2021) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
...le-runtime/src/main/java/org/apache/flink/table/filesystem/DeserializationSchemaAdapter.java
Outdated
Show resolved
Hide resolved
...k-table-runtime/src/main/java/org/apache/flink/table/filesystem/AbstractFileSystemTable.java
Outdated
Show resolved
Hide resolved
...k-table-runtime/src/main/java/org/apache/flink/table/filesystem/AbstractFileSystemTable.java
Outdated
Show resolved
Hide resolved
| @Override | ||
| public TableSchema getSchema() { | ||
| return schema; | ||
| return TableSchema.fromResolvedSchema(schema); |
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.
So migrating this isn't needed to fix the issue you had encountered?
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 code path should be hit if you're using the deprecated FileSystemFormatFactory, used only by csv and avro formats. As a followup I can work on migrating these 2 to the new factories, so we can prune this code completely.
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.
It's probably fine to leave that for now. That stack is deprecated as well anyway, so migrating it to the new Schema stack is probably not worth it.
387c38d to
92bef8d
Compare
|
@Airblader I've refactored the usages of schema and column to just use |
8829be9 to
8c367e2
Compare
twalthr
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.
Thanks for working on this @slinkydeveloper. We just had an offline discussion that we should aim to have nicer code to serve as a reference implementation for other developers. I took your changes as a reference and would propose to do implement FLINK-24399 first. What do you think?
18e0e60 to
94928a1
Compare
|
@flinkbot run azure |
twalthr
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.
Thanks for the update @slinkydeveloper. I added some comments.
...k-table-runtime/src/main/java/org/apache/flink/table/filesystem/AbstractFileSystemTable.java
Show resolved
Hide resolved
...le-runtime/src/main/java/org/apache/flink/table/filesystem/DeserializationSchemaAdapter.java
Outdated
Show resolved
Hide resolved
...flink-table-runtime/src/main/java/org/apache/flink/table/filesystem/FileSystemTableSink.java
Show resolved
Hide resolved
| private FileSystemFormatFactory.ReaderContext createReaderContext() { | ||
| return new FileSystemFormatFactory.ReaderContext() { | ||
| @Override | ||
| public TableSchema getSchema() { |
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 update this to DataType? it would be good to get rid of TableSchemaUtils
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.
I don't think we should, because the FileSystemFormatFactory is deprecated and we need to prune it anyway. I was thinking to do that in a separate issue (there are only 2 implementations for that, avro and csv IIRC)
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.
good point, haven't seen that is deprecated. then we don't need to do the effort.
...ink-table-runtime/src/main/java/org/apache/flink/table/filesystem/FileSystemTableSource.java
Outdated
Show resolved
Hide resolved
…Table Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
94928a1 to
0a0cd97
Compare
twalthr
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.
Thanks for the update @slinkydeveloper. LGTM.
…Table Signed-off-by: slinkydeveloper <francescoguard@gmail.com> This closes apache#17350.
Signed-off-by: slinkydeveloper francescoguard@gmail.com
What is the purpose of the change
Migrate
AbstractFileSystemTableto use the newResolvedSchemaAPIs as described here: https://issues.apache.org/jira/browse/FLINK-24359Brief change log
AbstractFileSystemTableand inheritors use the newResolvedSchemaAPIs. Some usage of the oldTableSchemapersists because it's required by theFileSystemFormatFactory.ReaderContextclass, but it will be easy to remove onceFileSystemFormatFactorywill be pruned.Verifying this change
This change is already covered by existing tests in
org.apache.flink.table.filesystem.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation