Skip to content

Conversation

@twalthr
Copy link
Contributor

@twalthr twalthr commented Jan 6, 2020

What is the purpose of the change

This PR connects Flink's new type inference to Calcite's type inference. It ensures that both Table API and SQL have exactly the same behavior and similar exception messages.

Note: This PR does not contain tests yet. They will be added as part of FLINK-15487 for testing end-to-end functionality.

Brief change log

  • Implementation of SqlFunction and SqlAggFunction

Verifying this change

Manually verified until code generation with some additional changes that will be part of FLINK-15487.

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, Yarn/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

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

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 6, 2020

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 cbb7375 (Mon Jan 06 16:18:58 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

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 Jan 6, 2020

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

Copy link
Contributor

@dawidwys dawidwys 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. Honestly I was even a bit surprised how straightforward is the mapping.


public static ArgumentCount any() {
return new ConstantArgumentCount(0, OPEN_INTERVAL);
return new ConstantArgumentCount(OPEN_INTERVAL, OPEN_INTERVAL);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? Does it make sense to have a special handling for a non present min value?

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 will skip this change for now. I remember there was some issue while mapping to Calcite but I'm sure we will notice it when we have more tests.

* Bridges to {@link ValueLiteralExpression#getValueAs(Class)}.
*/
@SuppressWarnings("unchecked")
protected static <T, V> T getLiteralValueAs(LiteralValueAccessor accessor, Class<T> clazz) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary V type.

/**
* Adopted from {@link org.apache.calcite.sql.validate.implicit.AbstractTypeCoercion}.
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The deprecated annotation was also adopted from Calcite. But I will remove it as it causes confusion.

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 it will be better to remove it. Esp. as in Calcite it is actually not deprecated. There is only @SuppressWarnings("deprecation") annotation.

@twalthr
Copy link
Contributor Author

twalthr commented Jan 9, 2020

Thank you @dawidwys. I will merge this in my next batch if there are no objections.

@twalthr twalthr closed this in 21d1c65 Jan 10, 2020
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.

4 participants