Skip to content

Conversation

@slinkydeveloper
Copy link
Contributor

@slinkydeveloper slinkydeveloper commented Sep 24, 2021

Signed-off-by: slinkydeveloper francescoguard@gmail.com

What is the purpose of the change

Migrate AbstractFileSystemTable to use the new ResolvedSchema APIs as described here: https://issues.apache.org/jira/browse/FLINK-24359

Brief change log

  • Now AbstractFileSystemTable and inheritors use the new ResolvedSchema APIs. Some usage of the old TableSchema persists because it's required by the FileSystemFormatFactory.ReaderContext class, but it will be easy to remove once FileSystemFormatFactory will 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:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 98fac3d (Fri Sep 24 10:58:43 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.

Details
The 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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 24, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@Override
public TableSchema getSchema() {
return schema;
return TableSchema.fromResolvedSchema(schema);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@slinkydeveloper slinkydeveloper force-pushed the FLINK-24359 branch 2 times, most recently from 387c38d to 92bef8d Compare September 27, 2021 08:10
@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Sep 27, 2021

@Airblader I've refactored the usages of schema and column to just use DataType, so once we get rid of FileSystemFormatFactory we can remove the usage of Schema inside the AbstractFileSystemTable class.

@slinkydeveloper slinkydeveloper force-pushed the FLINK-24359 branch 3 times, most recently from 8829be9 to 8c367e2 Compare September 28, 2021 07:47
Copy link
Contributor

@twalthr twalthr left a 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?

@slinkydeveloper slinkydeveloper force-pushed the FLINK-24359 branch 3 times, most recently from 18e0e60 to 94928a1 Compare October 4, 2021 15:44
@slinkydeveloper
Copy link
Contributor Author

@flinkbot run azure

Copy link
Contributor

@twalthr twalthr left a 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.

private FileSystemFormatFactory.ReaderContext createReaderContext() {
return new FileSystemFormatFactory.ReaderContext() {
@Override
public TableSchema getSchema() {
Copy link
Contributor

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

Copy link
Contributor Author

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)

Copy link
Contributor

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.

…Table

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Copy link
Contributor

@twalthr twalthr left a 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.

@twalthr twalthr closed this in 991dd04 Oct 7, 2021
@slinkydeveloper slinkydeveloper deleted the FLINK-24359 branch October 7, 2021 14:19
niklassemmler pushed a commit to niklassemmler/flink that referenced this pull request Feb 3, 2022
…Table

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>

This closes apache#17350.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants