You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "shuai-xu (via GitHub)" <gi...@apache.org> on 2025/08/01 04:04:55 UTC
[PR] [Gluten-10317][FLINK] Support state related operation [incubator-gluten]
shuai-xu opened a new pull request, #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320
## What changes were proposed in this pull request?
This pr update velox to a version, which contains support for state. And make serval operators contains Join, WindowJoin, GlobalAgg, LocalAgg use state for calculation. These operators's bahivor is like flink now, but still not the same.
(Fixes: \#10317)
## How was this patch tested?
This patch was tested by manual tests.
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "KevinyhZou (via GitHub)" <gi...@apache.org>.
KevinyhZou commented on code in PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#discussion_r2283883078
##########
gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:
##########
@@ -157,30 +172,59 @@ protected Transformation<RowData> translateToPlanInternal(
io.github.zhztheplayer.velox4j.type.RowType outputType =
(io.github.zhztheplayer.velox4j.type.RowType)
LogicalTypeConverter.toVLType(getOutputType());
- List<FieldAccessTypedExpr> partitionKeys = Utils.generateFieldAccesses(inputType, grouping);
- List<WindowFunction> functions = AggregateCallConverter.toFunctions(aggCalls, inputType);
+ List<FieldAccessTypedExpr> groupingKeys = Utils.generateFieldAccesses(inputType, grouping);
+ List<Aggregate> aggregates = AggregateCallConverter.toAggregates(aggCalls, inputType);
checkArgument(outputType.getNames().size() >= grouping.length + aggCalls.length);
- List<String> colNames =
+ List<String> aggNames =
outputType.getNames().stream()
.skip(grouping.length)
.limit(aggCalls.length)
.collect(Collectors.toList());
- PlanNode window =
- new WindowNode(
+ List<Integer> keyIndexes = Arrays.stream(grouping).boxed().collect(Collectors.toList());
+ PartitionFunctionSpec keySelectorSpec = new HashPartitionFunctionSpec(inputType, keyIndexes);
+ // TODO: support more window types.
+ Tuple5<Long, Long, Long, Integer, Integer> windowSpecParams =
+ WindowUtils.extractWindowParameters(windowing);
+ long size = windowSpecParams.f0;
+ long slide = windowSpecParams.f1;
+ long offset = windowSpecParams.f2;
+ int rowtimeIndex = windowSpecParams.f3;
+ int windowType = windowSpecParams.f4;
+ PartitionFunctionSpec sliceAssignerSpec =
+ new WindowPartitionFunctionSpec(inputType, rowtimeIndex, size, slide, offset, windowType);
Review Comment:
It seems the `WindowPartitionFunctionSpec` is newly added in `bigo-sg` velox,and it’s specifically for flink to divide the window into different slices,and spark window does not need this. and I think it is better to use some name that can be identified as flink specific. @PHILO-HE @shuai-xu
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "shuai-xu (via GitHub)" <gi...@apache.org>.
shuai-xu merged PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "shuai-xu (via GitHub)" <gi...@apache.org>.
shuai-xu commented on code in PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#discussion_r2286903677
##########
gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:
##########
@@ -157,30 +172,59 @@ protected Transformation<RowData> translateToPlanInternal(
io.github.zhztheplayer.velox4j.type.RowType outputType =
(io.github.zhztheplayer.velox4j.type.RowType)
LogicalTypeConverter.toVLType(getOutputType());
- List<FieldAccessTypedExpr> partitionKeys = Utils.generateFieldAccesses(inputType, grouping);
- List<WindowFunction> functions = AggregateCallConverter.toFunctions(aggCalls, inputType);
+ List<FieldAccessTypedExpr> groupingKeys = Utils.generateFieldAccesses(inputType, grouping);
+ List<Aggregate> aggregates = AggregateCallConverter.toAggregates(aggCalls, inputType);
checkArgument(outputType.getNames().size() >= grouping.length + aggCalls.length);
- List<String> colNames =
+ List<String> aggNames =
outputType.getNames().stream()
.skip(grouping.length)
.limit(aggCalls.length)
.collect(Collectors.toList());
- PlanNode window =
- new WindowNode(
+ List<Integer> keyIndexes = Arrays.stream(grouping).boxed().collect(Collectors.toList());
+ PartitionFunctionSpec keySelectorSpec = new HashPartitionFunctionSpec(inputType, keyIndexes);
+ // TODO: support more window types.
+ Tuple5<Long, Long, Long, Integer, Integer> windowSpecParams =
+ WindowUtils.extractWindowParameters(windowing);
+ long size = windowSpecParams.f0;
+ long slide = windowSpecParams.f1;
+ long offset = windowSpecParams.f2;
+ int rowtimeIndex = windowSpecParams.f3;
+ int windowType = windowSpecParams.f4;
+ PartitionFunctionSpec sliceAssignerSpec =
+ new WindowPartitionFunctionSpec(inputType, rowtimeIndex, size, slide, offset, windowType);
Review Comment:
I have rename related classes to begin with Stream, please help to review again.
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "KevinyhZou (via GitHub)" <gi...@apache.org>.
KevinyhZou commented on code in PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#discussion_r2283883078
##########
gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:
##########
@@ -157,30 +172,59 @@ protected Transformation<RowData> translateToPlanInternal(
io.github.zhztheplayer.velox4j.type.RowType outputType =
(io.github.zhztheplayer.velox4j.type.RowType)
LogicalTypeConverter.toVLType(getOutputType());
- List<FieldAccessTypedExpr> partitionKeys = Utils.generateFieldAccesses(inputType, grouping);
- List<WindowFunction> functions = AggregateCallConverter.toFunctions(aggCalls, inputType);
+ List<FieldAccessTypedExpr> groupingKeys = Utils.generateFieldAccesses(inputType, grouping);
+ List<Aggregate> aggregates = AggregateCallConverter.toAggregates(aggCalls, inputType);
checkArgument(outputType.getNames().size() >= grouping.length + aggCalls.length);
- List<String> colNames =
+ List<String> aggNames =
outputType.getNames().stream()
.skip(grouping.length)
.limit(aggCalls.length)
.collect(Collectors.toList());
- PlanNode window =
- new WindowNode(
+ List<Integer> keyIndexes = Arrays.stream(grouping).boxed().collect(Collectors.toList());
+ PartitionFunctionSpec keySelectorSpec = new HashPartitionFunctionSpec(inputType, keyIndexes);
+ // TODO: support more window types.
+ Tuple5<Long, Long, Long, Integer, Integer> windowSpecParams =
+ WindowUtils.extractWindowParameters(windowing);
+ long size = windowSpecParams.f0;
+ long slide = windowSpecParams.f1;
+ long offset = windowSpecParams.f2;
+ int rowtimeIndex = windowSpecParams.f3;
+ int windowType = windowSpecParams.f4;
+ PartitionFunctionSpec sliceAssignerSpec =
+ new WindowPartitionFunctionSpec(inputType, rowtimeIndex, size, slide, offset, windowType);
Review Comment:
It seems the `WindowPartitionFunctionSpec` is newly added in `bigo-sg` velox,and it’s specifically for flink to divide the window into different slices by the input `time` field,and spark window does not need this. and I think it is better to use some name that can be identified as flink specific. @PHILO-HE @shuai-xu
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [Gluten-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#issuecomment-3142098853
<!--
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/LICEGJ-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.
-->
Thanks for opening a pull request!
Could you open an issue for this pull request on Github Issues?
https://github.com/apache/incubator-gluten/issues
Then could you also rename ***commit message*** and ***pull request title*** in the following format?
[GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}
See also:
* [Other pull requests](https://github.com/apache/incubator-gluten/pulls/)
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [Gluten-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "zjuwangg (via GitHub)" <gi...@apache.org>.
zjuwangg commented on code in PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#discussion_r2247235465
##########
.github/workflows/flink.yml:
##########
@@ -43,7 +43,7 @@ jobs:
source /opt/rh/gcc-toolset-11/enable
sudo dnf install -y patchelf
git clone -b gluten-0530 https://github.com/bigo-sg/velox4j.git
- cd velox4j && git reset --hard 0eb9eef589692dbde953c36ecd2d8f9d3a34a59d
+ cd velox4j && git reset --hard 7bf3bd14624733230a395306275ccc3bed671b6c
Review Comment:
how about use tag instead of commit hash to track the branch.
##########
.github/workflows/flink.yml:
##########
@@ -43,7 +43,7 @@ jobs:
source /opt/rh/gcc-toolset-11/enable
sudo dnf install -y patchelf
git clone -b gluten-0530 https://github.com/bigo-sg/velox4j.git
- cd velox4j && git reset --hard 0eb9eef589692dbde953c36ecd2d8f9d3a34a59d
+ cd velox4j && git reset --hard 7bf3bd14624733230a395306275ccc3bed671b6c
Review Comment:
how about use tag instead of commit hash to track the version.
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#issuecomment-3181940376
https://github.com/apache/incubator-gluten/issues/10317
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [Gluten-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "shuai-xu (via GitHub)" <gi...@apache.org>.
shuai-xu commented on code in PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#discussion_r2250266698
##########
.github/workflows/flink.yml:
##########
@@ -43,7 +43,7 @@ jobs:
source /opt/rh/gcc-toolset-11/enable
sudo dnf install -y patchelf
git clone -b gluten-0530 https://github.com/bigo-sg/velox4j.git
- cd velox4j && git reset --hard 0eb9eef589692dbde953c36ecd2d8f9d3a34a59d
+ cd velox4j && git reset --hard 7bf3bd14624733230a395306275ccc3bed671b6c
Review Comment:
Good idea, we now use a private branch and it does't update with main branch, we can use git tag when after merge with the oap velox.
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-10317][FLINK] Support state related operation [incubator-gluten]
Posted by "PHILO-HE (via GitHub)" <gi...@apache.org>.
PHILO-HE commented on code in PR #10320:
URL: https://github.com/apache/incubator-gluten/pull/10320#discussion_r2272672094
##########
gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecLocalWindowAggregate.java:
##########
@@ -157,30 +172,59 @@ protected Transformation<RowData> translateToPlanInternal(
io.github.zhztheplayer.velox4j.type.RowType outputType =
(io.github.zhztheplayer.velox4j.type.RowType)
LogicalTypeConverter.toVLType(getOutputType());
- List<FieldAccessTypedExpr> partitionKeys = Utils.generateFieldAccesses(inputType, grouping);
- List<WindowFunction> functions = AggregateCallConverter.toFunctions(aggCalls, inputType);
+ List<FieldAccessTypedExpr> groupingKeys = Utils.generateFieldAccesses(inputType, grouping);
+ List<Aggregate> aggregates = AggregateCallConverter.toAggregates(aggCalls, inputType);
checkArgument(outputType.getNames().size() >= grouping.length + aggCalls.length);
- List<String> colNames =
+ List<String> aggNames =
outputType.getNames().stream()
.skip(grouping.length)
.limit(aggCalls.length)
.collect(Collectors.toList());
- PlanNode window =
- new WindowNode(
+ List<Integer> keyIndexes = Arrays.stream(grouping).boxed().collect(Collectors.toList());
+ PartitionFunctionSpec keySelectorSpec = new HashPartitionFunctionSpec(inputType, keyIndexes);
+ // TODO: support more window types.
+ Tuple5<Long, Long, Long, Integer, Integer> windowSpecParams =
+ WindowUtils.extractWindowParameters(windowing);
+ long size = windowSpecParams.f0;
+ long slide = windowSpecParams.f1;
+ long offset = windowSpecParams.f2;
+ int rowtimeIndex = windowSpecParams.f3;
+ int windowType = windowSpecParams.f4;
+ PartitionFunctionSpec sliceAssignerSpec =
+ new WindowPartitionFunctionSpec(inputType, rowtimeIndex, size, slide, offset, windowType);
Review Comment:
I note Flink's window is completely different from Spark SQL's. It would be better to use a better name to easily distinguish in Velox4j and Velox, e.g., `StreamWindowPartitionFunctionSpec` looks better for clarity than `WindowPartitionFunctionSpec`. cc @zhztheplayer
--
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: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org