Skip to content

Conversation

@dawidwys
Copy link
Contributor

What is the purpose of the change

This PR splits FunctionCatalog into Flink and Calcite specific parts. This is a necessary step to move the TableEnvironment to api module.

Brief change log

  • ported functions to validate & extract types from user function (ported from UserDefinedFunctionUtils)
  • ported & moved FunctionCatalog to api-java module
  • Introduced org.apache.flink.table.catalog.CatalogOperatorTable as a thin adapter between FunctionCatalog & SqlOperatorTable

Verifying this change

This change is already covered by existing tests.

Does this pull request potentially affect one of the following parts:

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

Documentation

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

@dawidwys dawidwys requested a review from aljoscha June 13, 2019 11:05
@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.

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

Copy link
Contributor

@aljoscha aljoscha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge! It's pretty neat now that the user-function catalog and the calcite catalog are separate. Makes me wonder why it wasn't like this before. 😅

if (Arrays.stream(clazz.getFields()).anyMatch(f -> f.getName().equals("MODULE$"))) {
throw new ValidationException(String.format(
"TableFunction implemented by class %s " +
"is a Scala object, it is forbidden since concurrent risks.", clazz.getCanonicalName()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's not in the scope of the PR but this should be this is forbidden because of concurrency problems when using them. Or something like it.

* Thin adapter between {@link SqlOperatorTable} and {@link FunctionCatalog}.
*/
@Internal
public class CatalogOperatorTable implements SqlOperatorTable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I don't really have a better name but maybe making it obvious that this is a bridge or adapter would be useful.

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 sort of inline with naming of similar pattern for CatalogManagerCalciteSchema which bridges/adapts between CatalogManager & Calcite's Schema.

@dawidwys dawidwys force-pushed the split-function-catalog branch from d0d7c5f to e22c695 Compare June 13, 2019 15:31
@dawidwys dawidwys force-pushed the split-function-catalog branch from 9627db7 to 24bd894 Compare June 13, 2019 16:04
).ifPresent(operatorList::add);
}

private boolean isUserFunction(SqlFunctionCategory category) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 'isNotUserFunction' for more clear and less misleading

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thank you!

@dawidwys dawidwys closed this in 51724b7 Jun 14, 2019
sjwiesman pushed a commit to sjwiesman/flink that referenced this pull request Jun 26, 2019
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