You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/05/31 04:13:24 UTC
[GitHub] [flink] beyond1920 opened a new pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
beyond1920 opened a new pull request #16025:
URL: https://github.com/apache/flink/pull/16025
## What is the purpose of the change
In theory, `StreamPhysicalWindowTableFunction` should works as a window assigner and emits at ends of window. However, `StreamPhysicalWindowTableFunction` could be simplified to a simple window assigner, and emits per record if it's successor node is one of `WindowRank`/`WindowJoin`/`WindowAggregate` with `WindowAttachedWindowingStrategy`, because those nodes would assign input records to windows have been assigned in input nodes, and trigger emit at ends of window.
Besides, we should add a limit that window is based on rowtime, because it has syntax problem if window is assigned based on the proc-time of previous operator.
The pr introduce a rule to simplify window-tvf.
## Brief change log
- Introduce `SimplifyWindowTableFunctionRule`
- Add a flag in `StreamPhysicalWindowTableFunction` to specify whether it is a simplify window tvf.
## Verifying this change
- existed UT in `WindowRankTest` and `WindowJoinTest`
## 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/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 applicable)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 6a317bf5b3b3b52fc2b8ae354c765113102d5622 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 47192b51a12b9ece1b38584fb2f923aecffcfa0b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672)
* efc8393f106d65d175015d6d925a40eb734dfc74 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721)
* 886492e4eed70a5d0d48494ab5a620d1c358ee5d UNKNOWN
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851157647
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 831214644ca9cfe039a636c53cd5c62d7bd9cd63 (Mon May 31 04:16:15 UTC 2021)
**Warnings:**
* No documentation files were touched! Remember to keep the Flink docs up to date!
<sub>Mention the bot in a comment to re-run the automated checks.</sub>
## 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](https://flink.apache.org/contributing/reviewing-prs.html) 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 <summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 6a317bf5b3b3b52fc2b8ae354c765113102d5622 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430)
* a25603bae997c02d5f203a6b8f8c2b68620916fc UNKNOWN
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
}, {
"hash" : "21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19759",
"triggerID" : "21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 886492e4eed70a5d0d48494ab5a620d1c358ee5d Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741)
* 21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19759)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] godfreyhe closed pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
godfreyhe closed pull request #16025:
URL: https://github.com/apache/flink/pull/16025
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660318419
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
Review comment:
Yes, the rule does not support `WindowAggregate` because for window table function + window Aggregate would be matched by `PullUpWindowTableFunctionIntoWindowAggregateRule`.
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
Review comment:
Because WindowAggregate could handle inputs with `WindowAttachedWindowingStrategy` and `TimeAttributeWindowingStrategy` which means it could handle watermark assigner itself while `WindowRank` and `Windowjoin` can't.
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -39,15 +39,18 @@
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
implements StreamExecNode<RowData> {
- private final WindowingStrategy windowingStrategy;
+ private final TimeAttributeWindowingStrategy windowingStrategy;
+ private final Boolean emitPerRecord;
Review comment:
done
##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
##########
@@ -486,7 +486,13 @@ object FlinkStreamRuleSets {
// incremental agg rule
IncrementalAggregateRule.INSTANCE,
// optimize window agg rule
- TwoStageOptimizedWindowAggregateRule.INSTANCE
- )
+ TwoStageOptimizedWindowAggregateRule.INSTANCE,
+ // simplify window tvf
+ SimplifyWindowTableFunctionRule.WITH_CALC_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_JOIN)
Review comment:
I didn't put into `PHYSICAL_OPT_RULES ` because the rules could not work well in Cost-based-optimization phase.
Because equivalent node didn't have less cost.
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -21,33 +21,70 @@
import org.apache.flink.api.dag.Transformation;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.planner.delegation.PlannerBase;
-import org.apache.flink.table.planner.plan.logical.WindowingStrategy;
+import org.apache.flink.table.planner.plan.logical.TimeAttributeWindowingStrategy;
import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.SingleTransformationTranslator;
import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* Stream {@link ExecNode} which acts as a table-valued function to assign a window for each row of
* the input relation. The return value of the new relation includes all the original columns as
* well additional 3 columns named {@code window_start}, {@code window_end}, {@code window_time} to
* indicate the assigned window.
*/
+@JsonIgnoreProperties(ignoreUnknown = true)
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
- implements StreamExecNode<RowData> {
+ implements StreamExecNode<RowData>, SingleTransformationTranslator<RowData> {
+
+ public static final String FIELD_NAME_WINDOWING = "windowing";
Review comment:
use `windowing` because keep consistency with WindowAggregate, WindowRank, WindowJoin
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 886492e4eed70a5d0d48494ab5a620d1c358ee5d Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r661090847
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -21,33 +21,70 @@
import org.apache.flink.api.dag.Transformation;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.planner.delegation.PlannerBase;
-import org.apache.flink.table.planner.plan.logical.WindowingStrategy;
+import org.apache.flink.table.planner.plan.logical.TimeAttributeWindowingStrategy;
import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.SingleTransformationTranslator;
import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* Stream {@link ExecNode} which acts as a table-valued function to assign a window for each row of
* the input relation. The return value of the new relation includes all the original columns as
* well additional 3 columns named {@code window_start}, {@code window_end}, {@code window_time} to
* indicate the assigned window.
*/
+@JsonIgnoreProperties(ignoreUnknown = true)
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
- implements StreamExecNode<RowData> {
+ implements StreamExecNode<RowData>, SingleTransformationTranslator<RowData> {
+
+ public static final String FIELD_NAME_WINDOWING = "windowing";
Review comment:
Make sense! Thx
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660324627
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
Review comment:
Because WindowAggregate could handle inputs with `WindowAttachedWindowingStrategy` and `TimeAttributeWindowingStrategy` which means it could handle watermark assigner itself while `WindowRank` and `Windowjoin` can't.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 6a317bf5b3b3b52fc2b8ae354c765113102d5622 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430)
* a25603bae997c02d5f203a6b8f8c2b68620916fc Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660540888
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -21,33 +21,70 @@
import org.apache.flink.api.dag.Transformation;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.planner.delegation.PlannerBase;
-import org.apache.flink.table.planner.plan.logical.WindowingStrategy;
+import org.apache.flink.table.planner.plan.logical.TimeAttributeWindowingStrategy;
import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.SingleTransformationTranslator;
import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* Stream {@link ExecNode} which acts as a table-valued function to assign a window for each row of
* the input relation. The return value of the new relation includes all the original columns as
* well additional 3 columns named {@code window_start}, {@code window_end}, {@code window_time} to
* indicate the assigned window.
*/
+@JsonIgnoreProperties(ignoreUnknown = true)
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
- implements StreamExecNode<RowData> {
+ implements StreamExecNode<RowData>, SingleTransformationTranslator<RowData> {
+
+ public static final String FIELD_NAME_WINDOWING = "windowing";
Review comment:
```suggestion
public static final String FIELD_NAME_WINDOWING = "windowingStrategy";
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-870197372
LGTM. cc @godfreyhe to have another review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] godfreyhe commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660269928
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
Review comment:
This rule can be split to separate rules ? that will be more clear and we do not need so many `if else` and constant numbers.
##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
##########
@@ -486,7 +486,13 @@ object FlinkStreamRuleSets {
// incremental agg rule
IncrementalAggregateRule.INSTANCE,
// optimize window agg rule
- TwoStageOptimizedWindowAggregateRule.INSTANCE
- )
+ TwoStageOptimizedWindowAggregateRule.INSTANCE,
+ // simplify window tvf
+ SimplifyWindowTableFunctionRule.WITH_CALC_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_JOIN)
Review comment:
can those rules be put into `PHYSICAL_OPT_RULES` ?
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -39,15 +39,18 @@
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
implements StreamExecNode<RowData> {
- private final WindowingStrategy windowingStrategy;
+ private final TimeAttributeWindowingStrategy windowingStrategy;
+ private final Boolean emitPerRecord;
Review comment:
nit: this class should support json ser/de.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a25603bae997c02d5f203a6b8f8c2b68620916fc Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864)
* 47192b51a12b9ece1b38584fb2f923aecffcfa0b Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 47192b51a12b9ece1b38584fb2f923aecffcfa0b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672)
* efc8393f106d65d175015d6d925a40eb734dfc74 UNKNOWN
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-870197372
LGTM. cc @godfreyhe to have another review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] godfreyhe commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r661249444
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRules.java
##########
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptRuleOperand;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if time attribute is event-time
+ * and followed by {@link StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin}.
+ */
+public interface SimplifyWindowTableFunctionRules {
+ SimplifyWindowTableFunctionWithWindowRankRule WITH_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithWindowRankRule();
+ SimplifyWindowTableFunctionWithCalcWindowRankRule WITH_CALC_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithCalcWindowRankRule();
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule WITH_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule WITH_LEFT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule
+ WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule();
+}
+
+abstract class SimplifyWindowTableFunctionRuleBase extends RelOptRule {
+ SimplifyWindowTableFunctionRuleBase(RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ /**
+ * Replace the leaf node, and build a new {@link RelNode} tree in the given nodes order which is
+ * in root-down direction.
+ */
+ protected RelNode rebuild(List<RelNode> nodes) {
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) nodes.get(nodes.size() - 1);
+ if (needSimplify(windowTVF)) {
+ final StreamPhysicalWindowTableFunction newWindowTVF = windowTVF.copy(true);
+ RelNode root = newWindowTVF;
+ for (int i = nodes.size() - 2; i >= 0; i--) {
+ RelNode node = nodes.get(i);
+ root = node.copy(node.getTraitSet(), Collections.singletonList(root));
+ }
+ return root;
+ } else {
+ return nodes.get(0);
+ }
+ }
+
+ protected boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ // excludes windowTVF which is already simplified to emit by per record
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowRankRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowRankRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ StreamPhysicalWindowRank windowRank = call.rel(0);
+ List<RelNode> rels = call.getRelList();
+ RelNode newTree = rebuild(rels);
+ call.getPlanner().prune(windowRank);
+ call.transformTo(newTree);
+ }
+}
+
+class SimplifyWindowTableFunctionWithWindowRankRule
+ extends SimplifyWindowTableFunctionWithWindowRankRuleBase {
+
+ SimplifyWindowTableFunctionWithWindowRankRule() {
+ super(
+ operand(
+ StreamPhysicalWindowRank.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionWithWindowRankRule");
+ }
+}
+
+class SimplifyWindowTableFunctionWithCalcWindowRankRule
+ extends SimplifyWindowTableFunctionWithWindowRankRuleBase {
+
+ SimplifyWindowTableFunctionWithCalcWindowRankRule() {
+ super(
+ operand(
+ StreamPhysicalWindowRank.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(
+ StreamPhysicalCalc.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())))),
+ "SimplifyWindowTableFunctionWithCalcWindowRankRule");
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowJoinRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowJoinRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ final StreamPhysicalWindowTableFunction leftWindowTVF = getLeftWindowTVF(call);
+ List<RelNode> rels = call.getRelList();
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ final StreamPhysicalWindowJoin join = call.rel(0);
+ final RelNode newLeft = buildNewLeftTree(call);
+ final RelNode newRight = buildNewRightTree(call);
+ final RelNode newJoin =
+ join.copy(
+ join.getTraitSet(),
+ join.getCondition(),
+ newLeft,
+ newRight,
+ join.getJoinType(),
+ join.isSemiJoinDone());
+ call.getPlanner().prune(join);
+ call.transformTo(newJoin);
+ }
+
+ abstract StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call);
+
+ abstract RelNode buildNewLeftTree(RelOptRuleCall call);
+
+ abstract RelNode buildNewRightTree(RelOptRuleCall call);
+}
+
+class SimplifyWindowTableFunctionRuleWithWindowJoinRule
+ extends SimplifyWindowTableFunctionWithWindowJoinRuleBase {
+
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule() {
+ super(
+ operand(
+ StreamPhysicalWindowJoin.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())),
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionRuleWithWindowJoinRule");
+ }
+
+ @Override
+ StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call) {
+ return (StreamPhysicalWindowTableFunction) call.rel(2);
+ }
+
+ @Override
+ RelNode buildNewLeftTree(RelOptRuleCall call) {
+ return rebuild(call.getRelList().subList(1, 3));
+ }
+
+ @Override
+ RelNode buildNewRightTree(RelOptRuleCall call) {
+ return rebuild(call.getRelList().subList(3, 5));
+ }
+}
+
+class SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule
+ extends SimplifyWindowTableFunctionWithWindowJoinRuleBase {
+
+ SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule() {
+ super(
+ operand(
+ StreamPhysicalWindowJoin.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(
+ StreamPhysicalCalc.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule");
+ }
+
+ @Override
+ StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call) {
+ return (StreamPhysicalWindowTableFunction) call.rel(3);
Review comment:
ditto
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRules.java
##########
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptRuleOperand;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if time attribute is event-time
+ * and followed by {@link StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin}.
+ */
+public interface SimplifyWindowTableFunctionRules {
+ SimplifyWindowTableFunctionWithWindowRankRule WITH_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithWindowRankRule();
+ SimplifyWindowTableFunctionWithCalcWindowRankRule WITH_CALC_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithCalcWindowRankRule();
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule WITH_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule WITH_LEFT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule
+ WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule();
+}
+
+abstract class SimplifyWindowTableFunctionRuleBase extends RelOptRule {
+ SimplifyWindowTableFunctionRuleBase(RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ /**
+ * Replace the leaf node, and build a new {@link RelNode} tree in the given nodes order which is
+ * in root-down direction.
+ */
+ protected RelNode rebuild(List<RelNode> nodes) {
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) nodes.get(nodes.size() - 1);
+ if (needSimplify(windowTVF)) {
+ final StreamPhysicalWindowTableFunction newWindowTVF = windowTVF.copy(true);
+ RelNode root = newWindowTVF;
+ for (int i = nodes.size() - 2; i >= 0; i--) {
+ RelNode node = nodes.get(i);
+ root = node.copy(node.getTraitSet(), Collections.singletonList(root));
+ }
+ return root;
+ } else {
+ return nodes.get(0);
+ }
+ }
+
+ protected boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ // excludes windowTVF which is already simplified to emit by per record
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowRankRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowRankRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ StreamPhysicalWindowRank windowRank = call.rel(0);
+ List<RelNode> rels = call.getRelList();
+ RelNode newTree = rebuild(rels);
+ call.getPlanner().prune(windowRank);
+ call.transformTo(newTree);
+ }
+}
+
+class SimplifyWindowTableFunctionWithWindowRankRule
+ extends SimplifyWindowTableFunctionWithWindowRankRuleBase {
+
+ SimplifyWindowTableFunctionWithWindowRankRule() {
+ super(
+ operand(
+ StreamPhysicalWindowRank.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionWithWindowRankRule");
+ }
+}
+
+class SimplifyWindowTableFunctionWithCalcWindowRankRule
+ extends SimplifyWindowTableFunctionWithWindowRankRuleBase {
+
+ SimplifyWindowTableFunctionWithCalcWindowRankRule() {
+ super(
+ operand(
+ StreamPhysicalWindowRank.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(
+ StreamPhysicalCalc.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())))),
+ "SimplifyWindowTableFunctionWithCalcWindowRankRule");
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowJoinRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowJoinRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ final StreamPhysicalWindowTableFunction leftWindowTVF = getLeftWindowTVF(call);
+ List<RelNode> rels = call.getRelList();
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ final StreamPhysicalWindowJoin join = call.rel(0);
+ final RelNode newLeft = buildNewLeftTree(call);
+ final RelNode newRight = buildNewRightTree(call);
+ final RelNode newJoin =
+ join.copy(
+ join.getTraitSet(),
+ join.getCondition(),
+ newLeft,
+ newRight,
+ join.getJoinType(),
+ join.isSemiJoinDone());
+ call.getPlanner().prune(join);
+ call.transformTo(newJoin);
+ }
+
+ abstract StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call);
+
+ abstract RelNode buildNewLeftTree(RelOptRuleCall call);
+
+ abstract RelNode buildNewRightTree(RelOptRuleCall call);
+}
+
+class SimplifyWindowTableFunctionRuleWithWindowJoinRule
+ extends SimplifyWindowTableFunctionWithWindowJoinRuleBase {
+
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule() {
+ super(
+ operand(
+ StreamPhysicalWindowJoin.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())),
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionRuleWithWindowJoinRule");
+ }
+
+ @Override
+ StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call) {
+ return (StreamPhysicalWindowTableFunction) call.rel(2);
+ }
+
+ @Override
+ RelNode buildNewLeftTree(RelOptRuleCall call) {
+ return rebuild(call.getRelList().subList(1, 3));
+ }
+
+ @Override
+ RelNode buildNewRightTree(RelOptRuleCall call) {
+ return rebuild(call.getRelList().subList(3, 5));
+ }
+}
+
+class SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule
+ extends SimplifyWindowTableFunctionWithWindowJoinRuleBase {
+
+ SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule() {
+ super(
+ operand(
+ StreamPhysicalWindowJoin.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(
+ StreamPhysicalCalc.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule");
+ }
+
+ @Override
+ StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call) {
+ return (StreamPhysicalWindowTableFunction) call.rel(3);
+ }
+
+ @Override
+ RelNode buildNewLeftTree(RelOptRuleCall call) {
+ return rebuild(call.getRelList().subList(1, 4));
+ }
+
+ @Override
+ RelNode buildNewRightTree(RelOptRuleCall call) {
+ return rebuild(call.getRelList().subList(4, 6));
+ }
+}
+
+class SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule
+ extends SimplifyWindowTableFunctionWithWindowJoinRuleBase {
+
+ SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule() {
+ super(
+ operand(
+ StreamPhysicalWindowJoin.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())),
+ operand(
+ StreamPhysicalExchange.class,
+ operand(
+ StreamPhysicalCalc.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())))),
+ "SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule");
+ }
+
+ @Override
+ StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call) {
+ return (StreamPhysicalWindowTableFunction) call.rel(2);
Review comment:
ditto
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRules.java
##########
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptRuleOperand;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if time attribute is event-time
+ * and followed by {@link StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin}.
+ */
+public interface SimplifyWindowTableFunctionRules {
+ SimplifyWindowTableFunctionWithWindowRankRule WITH_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithWindowRankRule();
+ SimplifyWindowTableFunctionWithCalcWindowRankRule WITH_CALC_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithCalcWindowRankRule();
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule WITH_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule WITH_LEFT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule
+ WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule();
+}
+
+abstract class SimplifyWindowTableFunctionRuleBase extends RelOptRule {
+ SimplifyWindowTableFunctionRuleBase(RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ /**
+ * Replace the leaf node, and build a new {@link RelNode} tree in the given nodes order which is
+ * in root-down direction.
+ */
+ protected RelNode rebuild(List<RelNode> nodes) {
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) nodes.get(nodes.size() - 1);
+ if (needSimplify(windowTVF)) {
+ final StreamPhysicalWindowTableFunction newWindowTVF = windowTVF.copy(true);
+ RelNode root = newWindowTVF;
+ for (int i = nodes.size() - 2; i >= 0; i--) {
+ RelNode node = nodes.get(i);
+ root = node.copy(node.getTraitSet(), Collections.singletonList(root));
+ }
+ return root;
+ } else {
+ return nodes.get(0);
+ }
+ }
+
+ protected boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ // excludes windowTVF which is already simplified to emit by per record
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowRankRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowRankRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ StreamPhysicalWindowRank windowRank = call.rel(0);
+ List<RelNode> rels = call.getRelList();
+ RelNode newTree = rebuild(rels);
+ call.getPlanner().prune(windowRank);
Review comment:
unnecessary code
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRules.java
##########
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptRuleOperand;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if time attribute is event-time
+ * and followed by {@link StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin}.
+ */
+public interface SimplifyWindowTableFunctionRules {
+ SimplifyWindowTableFunctionWithWindowRankRule WITH_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithWindowRankRule();
+ SimplifyWindowTableFunctionWithCalcWindowRankRule WITH_CALC_WINDOW_RANK =
+ new SimplifyWindowTableFunctionWithCalcWindowRankRule();
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule WITH_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule WITH_LEFT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithRightCalcWindowJoinRule();
+ SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule
+ WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ new SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoinRule();
+}
+
+abstract class SimplifyWindowTableFunctionRuleBase extends RelOptRule {
+ SimplifyWindowTableFunctionRuleBase(RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ /**
+ * Replace the leaf node, and build a new {@link RelNode} tree in the given nodes order which is
+ * in root-down direction.
+ */
+ protected RelNode rebuild(List<RelNode> nodes) {
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) nodes.get(nodes.size() - 1);
+ if (needSimplify(windowTVF)) {
+ final StreamPhysicalWindowTableFunction newWindowTVF = windowTVF.copy(true);
+ RelNode root = newWindowTVF;
+ for (int i = nodes.size() - 2; i >= 0; i--) {
+ RelNode node = nodes.get(i);
+ root = node.copy(node.getTraitSet(), Collections.singletonList(root));
+ }
+ return root;
+ } else {
+ return nodes.get(0);
+ }
+ }
+
+ protected boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ // excludes windowTVF which is already simplified to emit by per record
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowRankRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowRankRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ StreamPhysicalWindowRank windowRank = call.rel(0);
+ List<RelNode> rels = call.getRelList();
+ RelNode newTree = rebuild(rels);
+ call.getPlanner().prune(windowRank);
+ call.transformTo(newTree);
+ }
+}
+
+class SimplifyWindowTableFunctionWithWindowRankRule
+ extends SimplifyWindowTableFunctionWithWindowRankRuleBase {
+
+ SimplifyWindowTableFunctionWithWindowRankRule() {
+ super(
+ operand(
+ StreamPhysicalWindowRank.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionWithWindowRankRule");
+ }
+}
+
+class SimplifyWindowTableFunctionWithCalcWindowRankRule
+ extends SimplifyWindowTableFunctionWithWindowRankRuleBase {
+
+ SimplifyWindowTableFunctionWithCalcWindowRankRule() {
+ super(
+ operand(
+ StreamPhysicalWindowRank.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(
+ StreamPhysicalCalc.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())))),
+ "SimplifyWindowTableFunctionWithCalcWindowRankRule");
+ }
+}
+
+abstract class SimplifyWindowTableFunctionWithWindowJoinRuleBase
+ extends SimplifyWindowTableFunctionRuleBase {
+ SimplifyWindowTableFunctionWithWindowJoinRuleBase(
+ RelOptRuleOperand operand, String description) {
+ super(operand, description);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ final StreamPhysicalWindowTableFunction leftWindowTVF = getLeftWindowTVF(call);
+ List<RelNode> rels = call.getRelList();
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ final StreamPhysicalWindowJoin join = call.rel(0);
+ final RelNode newLeft = buildNewLeftTree(call);
+ final RelNode newRight = buildNewRightTree(call);
+ final RelNode newJoin =
+ join.copy(
+ join.getTraitSet(),
+ join.getCondition(),
+ newLeft,
+ newRight,
+ join.getJoinType(),
+ join.isSemiJoinDone());
+ call.getPlanner().prune(join);
+ call.transformTo(newJoin);
+ }
+
+ abstract StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call);
+
+ abstract RelNode buildNewLeftTree(RelOptRuleCall call);
+
+ abstract RelNode buildNewRightTree(RelOptRuleCall call);
+}
+
+class SimplifyWindowTableFunctionRuleWithWindowJoinRule
+ extends SimplifyWindowTableFunctionWithWindowJoinRuleBase {
+
+ SimplifyWindowTableFunctionRuleWithWindowJoinRule() {
+ super(
+ operand(
+ StreamPhysicalWindowJoin.class,
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any())),
+ operand(
+ StreamPhysicalExchange.class,
+ operand(StreamPhysicalWindowTableFunction.class, any()))),
+ "SimplifyWindowTableFunctionRuleWithWindowJoinRule");
+ }
+
+ @Override
+ StreamPhysicalWindowTableFunction getLeftWindowTVF(RelOptRuleCall call) {
+ return (StreamPhysicalWindowTableFunction) call.rel(2);
Review comment:
unnecessary cast
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "CANCELED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* efc8393f106d65d175015d6d925a40eb734dfc74 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721)
* 886492e4eed70a5d0d48494ab5a620d1c358ee5d Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-871182358
@godfreyhe I've split `SimplyWindowTableFunctionRule` into multiple subclass, please have a look.
Thanks a lot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r659642560
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 3));
+ newRight = rebuild(rels.subList(3, 5));
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 3));
+ newRight = rebuild(rels.subList(3, 6));
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 4));
+ newRight = rebuild(rels.subList(4, 6));
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 4));
+ newRight = rebuild(rels.subList(4, 7));
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowJoin join = call.rel(0);
+ final RelNode newJoin =
+ join.copy(
+ join.getTraitSet(),
+ join.getCondition(),
+ newLeft,
+ newRight,
+ join.getJoinType(),
+ join.isSemiJoinDone());
+ call.transformTo(newJoin);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ private boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
Review comment:
```suggestion
return windowTVF.windowing().isRowtime() && windowTVF.emitPerRecord();
```
Do I understand right?👆
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 47192b51a12b9ece1b38584fb2f923aecffcfa0b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672)
* efc8393f106d65d175015d6d925a40eb734dfc74 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721)
* 886492e4eed70a5d0d48494ab5a620d1c358ee5d Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660395788
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -39,15 +39,18 @@
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
implements StreamExecNode<RowData> {
- private final WindowingStrategy windowingStrategy;
+ private final TimeAttributeWindowingStrategy windowingStrategy;
+ private final Boolean emitPerRecord;
Review comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
}, {
"hash" : "21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 886492e4eed70a5d0d48494ab5a620d1c358ee5d Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741)
* 21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4 UNKNOWN
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-870424104
@godfreyhe Thank for your review. I have updated the pr:
1. split the `SimplifyWindowTableFunctionRule` into two subclass.
2. Add json ser/de for `StreamExecWindowTableFunction`, and add `WindowTableFunctionJsonPlanTest` to cover it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] godfreyhe closed pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
godfreyhe closed pull request #16025:
URL: https://github.com/apache/flink/pull/16025
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 47192b51a12b9ece1b38584fb2f923aecffcfa0b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672)
* efc8393f106d65d175015d6d925a40eb734dfc74 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 6a317bf5b3b3b52fc2b8ae354c765113102d5622 UNKNOWN
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-871315654
@godfreyhe Thanks for your review, I've address all your comments, please have another look, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-870424104
@godfreyhe Thank for your review. I have updated the pr:
1. split the `SimplifyWindowTableFunctionRule` into two subclass.
2. Add json ser/de for `StreamExecWindowTableFunction`, and add `WindowTableFunctionJsonPlanTest` to cover it.
Please have another look, thanks a lot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660540888
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -21,33 +21,70 @@
import org.apache.flink.api.dag.Transformation;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.planner.delegation.PlannerBase;
-import org.apache.flink.table.planner.plan.logical.WindowingStrategy;
+import org.apache.flink.table.planner.plan.logical.TimeAttributeWindowingStrategy;
import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.SingleTransformationTranslator;
import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* Stream {@link ExecNode} which acts as a table-valued function to assign a window for each row of
* the input relation. The return value of the new relation includes all the original columns as
* well additional 3 columns named {@code window_start}, {@code window_end}, {@code window_time} to
* indicate the assigned window.
*/
+@JsonIgnoreProperties(ignoreUnknown = true)
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
- implements StreamExecNode<RowData> {
+ implements StreamExecNode<RowData>, SingleTransformationTranslator<RowData> {
+
+ public static final String FIELD_NAME_WINDOWING = "windowing";
Review comment:
```suggestion
public static final String FIELD_NAME_WINDOWING = "windowingStrategy";
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] zjuwangg commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
zjuwangg commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r659705182
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 3));
+ newRight = rebuild(rels.subList(3, 5));
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 3));
+ newRight = rebuild(rels.subList(3, 6));
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 4));
+ newRight = rebuild(rels.subList(4, 6));
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 4));
+ newRight = rebuild(rels.subList(4, 7));
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowJoin join = call.rel(0);
+ final RelNode newJoin =
+ join.copy(
+ join.getTraitSet(),
+ join.getCondition(),
+ newLeft,
+ newRight,
+ join.getJoinType(),
+ join.isSemiJoinDone());
+ call.transformTo(newJoin);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ private boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
Review comment:
Thanks for your explanation. I got your meaning.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660396684
##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
##########
@@ -486,7 +486,13 @@ object FlinkStreamRuleSets {
// incremental agg rule
IncrementalAggregateRule.INSTANCE,
// optimize window agg rule
- TwoStageOptimizedWindowAggregateRule.INSTANCE
- )
+ TwoStageOptimizedWindowAggregateRule.INSTANCE,
+ // simplify window tvf
+ SimplifyWindowTableFunctionRule.WITH_CALC_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_JOIN)
Review comment:
I didn't put into `PHYSICAL_OPT_RULES ` because the rules could not work well in Cost-based-optimization phase.
Because equivalent node didn't have less cost.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660318419
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
Review comment:
Yes, the rule does not support `WindowAggregate` because for window table function + window Aggregate would be matched by `PullUpWindowTableFunctionIntoWindowAggregateRule`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-870424104
@godfreyhe Thank for your review. I have updated the pr:
1. split the `SimplifyWindowTableFunctionRule` into two subclass.
2. Add json ser/de for `StreamExecWindowTableFunction`, and add `WindowTableFunctionJsonPlanTest` to cover it.
Please have another look, thanks a lot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r659691154
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 3));
+ newRight = rebuild(rels.subList(3, 5));
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 3));
+ newRight = rebuild(rels.subList(3, 6));
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 4));
+ newRight = rebuild(rels.subList(4, 6));
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ newLeft = rebuild(rels.subList(1, 4));
+ newRight = rebuild(rels.subList(4, 7));
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowJoin join = call.rel(0);
+ final RelNode newJoin =
+ join.copy(
+ join.getTraitSet(),
+ join.getCondition(),
+ newLeft,
+ newRight,
+ join.getJoinType(),
+ join.isSemiJoinDone());
+ call.transformTo(newJoin);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ private boolean needSimplify(StreamPhysicalWindowTableFunction windowTVF) {
+ return windowTVF.windowing().isRowtime() && !windowTVF.emitPerRecord();
Review comment:
using !windowTVF.emitPerRecord() to exclude those window table function nodes which are already emit per record. Because there is no need to create new nodes for those window table function nodes.
I could add some comments here to explain logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] godfreyhe commented on a change in pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #16025:
URL: https://github.com/apache/flink/pull/16025#discussion_r660269928
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/SimplifyWindowTableFunctionRule.java
##########
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalExchange;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowJoin;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowRank;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalWindowTableFunction;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.plan.RelRule;
+import org.apache.calcite.rel.RelNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Planner rule that tries to simplify emit behavior of {@link StreamPhysicalWindowTableFunction} to
+ * emit per record instead of emit after watermark passed window end if the successor node is {@link
+ * StreamPhysicalWindowRank} or {@link StreamPhysicalWindowJoin} which with
+ * rowtime-WindowingStrategy.
+ */
+public class SimplifyWindowTableFunctionRule
+ extends RelRule<SimplifyWindowTableFunctionRule.Config> {
+
+ public static final RelOptRule WITH_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowRank")
+ .as(Config.class)
+ .withWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_CALC_WINDOW_RANK =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithCalcWindowRank")
+ .as(Config.class)
+ .withCalcWindowRank()
+ .toRule();
+
+ public static final RelOptRule WITH_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithWindowJoin")
+ .as(Config.class)
+ .withWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftCalcWindowJoin")
+ .as(Config.class)
+ .withLeftCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithRightCalcWindowJoin")
+ .as(Config.class)
+ .withRightCalcWindowJoin()
+ .toRule();
+
+ public static final RelOptRule WITH_LEFT_RIGHT_CALC_WINDOW_JOIN =
+ Config.EMPTY
+ .withDescription("SimplifyWindowTableFunctionRuleWithLeftRightCalcWindowJoin")
+ .as(Config.class)
+ .withLeftRightCalcWindowJoin()
+ .toRule();
+
+ public SimplifyWindowTableFunctionRule(Config config) {
+ super(config);
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ final int windowTVFIdx = rels.size() - 1;
+ final StreamPhysicalWindowTableFunction windowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(windowTVFIdx);
+ return needSimplify(windowTVF);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode leftWindowTVFRel;
+ if (call.rule == WITH_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(2);
+ } else if (call.rule == WITH_LEFT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else if (call.rule == WITH_LEFT_RIGHT_CALC_WINDOW_JOIN) {
+ leftWindowTVFRel = rels.get(3);
+ } else {
+ throw new TableException("This should never happen. Please file an issue.");
+ }
+ final StreamPhysicalWindowTableFunction leftWindowTVF =
+ (StreamPhysicalWindowTableFunction) leftWindowTVFRel;
+ final StreamPhysicalWindowTableFunction rightWindowTVF =
+ (StreamPhysicalWindowTableFunction) rels.get(rels.size() - 1);
+ return needSimplify(leftWindowTVF) || needSimplify(rightWindowTVF);
+ } else {
+ throw new IllegalStateException(
+ this.getClass().getName()
+ + " matches a wrong relation tree: "
+ + RelOptUtil.toString(node));
+ }
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ List<RelNode> rels = call.getRelList();
+ final RelNode node = rels.get(0);
+ if (node instanceof StreamPhysicalWindowRank) {
+ RelNode newTree = rebuild(rels);
+ call.transformTo(newTree);
+ } else if (node instanceof StreamPhysicalWindowJoin) {
+ RelNode newLeft;
+ RelNode newRight;
+ if (call.rule == WITH_WINDOW_JOIN) {
Review comment:
This rule can be split to separate rules ? that will be more clear and we do not need so many `if else` and constant numbers.
##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
##########
@@ -486,7 +486,13 @@ object FlinkStreamRuleSets {
// incremental agg rule
IncrementalAggregateRule.INSTANCE,
// optimize window agg rule
- TwoStageOptimizedWindowAggregateRule.INSTANCE
- )
+ TwoStageOptimizedWindowAggregateRule.INSTANCE,
+ // simplify window tvf
+ SimplifyWindowTableFunctionRule.WITH_CALC_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_RANK,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_LEFT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_RIGHT_CALC_WINDOW_JOIN,
+ SimplifyWindowTableFunctionRule.WITH_WINDOW_JOIN)
Review comment:
can those rules be put into `PHYSICAL_OPT_RULES` ?
##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWindowTableFunction.java
##########
@@ -39,15 +39,18 @@
public class StreamExecWindowTableFunction extends ExecNodeBase<RowData>
implements StreamExecNode<RowData> {
- private final WindowingStrategy windowingStrategy;
+ private final TimeAttributeWindowingStrategy windowingStrategy;
+ private final Boolean emitPerRecord;
Review comment:
nit: this class should support json ser/de.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a25603bae997c02d5f203a6b8f8c2b68620916fc Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864)
* 47192b51a12b9ece1b38584fb2f923aecffcfa0b UNKNOWN
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 6a317bf5b3b3b52fc2b8ae354c765113102d5622 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
}, {
"hash" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19672",
"triggerID" : "47192b51a12b9ece1b38584fb2f923aecffcfa0b",
"triggerType" : "PUSH"
}, {
"hash" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19721",
"triggerID" : "efc8393f106d65d175015d6d925a40eb734dfc74",
"triggerType" : "PUSH"
}, {
"hash" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19741",
"triggerID" : "886492e4eed70a5d0d48494ab5a620d1c358ee5d",
"triggerType" : "PUSH"
}, {
"hash" : "21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19759",
"triggerID" : "21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 21be2e6ac35307bd7eec9d9a1f82a1586ab57eb4 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=19759)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18430",
"triggerID" : "6a317bf5b3b3b52fc2b8ae354c765113102d5622",
"triggerType" : "PUSH"
}, {
"hash" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864",
"triggerID" : "a25603bae997c02d5f203a6b8f8c2b68620916fc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a25603bae997c02d5f203a6b8f8c2b68620916fc Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18864)
<details>
<summary>Bot commands</summary>
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
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-851164626
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] beyond1920 commented on pull request #16025: [FLINK-22714][table-planner-blink] Simplify window TVF to a simple window assigner if successor node is WindowRank or WindowJoin.
Posted by GitBox <gi...@apache.org>.
beyond1920 commented on pull request #16025:
URL: https://github.com/apache/flink/pull/16025#issuecomment-870424104
@godfreyhe Thank for your review. I have updated the pr:
1. split the `SimplifyWindowTableFunctionRule` into two subclass.
2. Add json ser/de for `StreamExecWindowTableFunction`, and add `WindowTableFunctionJsonPlanTest` to cover it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org