Skip to content

Conversation

@godfreyhe
Copy link
Contributor

What is the purpose of the change

Add support for generating optimized logical plan for stream window aggregate

Brief change log

  • refactor batch window aggregate
  • add RelTimeIndicatorConverter to materialize rowtime/proctime type to timestamp type
  • add WindowAggregateReduceFunctionsRule to reduce complex aggregate function to simpler forms
  • add StreamExecGroupWindowAggregateRule to convert logical window aggregate to stream physical window aggregate

Verifying this change

This change added tests and can be verified as follows:

  • Added WindowAggregateTest that validates physical plan for window aggregate queries
  • Added RelTimeIndicatorConverterTest that validates plan after materialized

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? (no)
  • If yes, how is the feature documented? (not documented)

@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

* 0 means no delay (fire on every element).
* > 0 means the fire interval
*/
private var earlyFireInterval = DEFAULT_FIRE_INTERVAL
Copy link
Contributor

Choose a reason for hiding this comment

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

cc @wuchong here, do we want to support early fire in 1.9.0?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can support it if we expose early&late interval through options in TableConfig.

I think it's nice to have it.

visitSetOp(minus)

override def visit(sort: LogicalSort): RelNode = {

Copy link
Contributor

Choose a reason for hiding this comment

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

delete blank line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

/**
* Streaming group window aggregate physical node which will be translate to window operator.
*
* If requirements satisfied, it will be translated into minibatch window operator, otherwise,
Copy link
Member

Choose a reason for hiding this comment

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

The minibatch-window is still in beta in Blink. I think we can support it after 1.9 release.

What do you think about removing minibatch-window relative comments and codes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes sense to me

null,
OperandTypes.NILADIC,
SqlFunctionCategory.TIMEDATE);
ReturnTypes.cascade(ReturnTypes.explicit(SqlTypeName.TIMESTAMP), SqlTypeTransforms.TO_NULLABLE),
Copy link
Member

Choose a reason for hiding this comment

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

PROCTIME() is a built-in function used to generate proctime attribute field, whose return type must be proctime time indicator.

I think what you want is ProctimeMaterializeSqlFunction which materialize a proctime field into Timestamp field.

So I think we don't need to change this file. We should use FlinkSqlOperatorTable.PROCTIME_MATERIALIZE in RelTimeIndicatorConverter.

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 didn't notice ProctimeMaterializeSqlFunction's existence before, i will revert the changes in ProctimeSqlFunction

@wuchong
Copy link
Member

wuchong commented May 7, 2019

Thanks @godfreyhe , it looks good to me now.

@KurtYoung KurtYoung merged commit c6ac93a into apache:master May 7, 2019
@godfreyhe godfreyhe deleted the FLINK-12345 branch June 1, 2019 09:53
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