You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "HuangXingBo (via GitHub)" <gi...@apache.org> on 2024/10/18 08:11:22 UTC
[PR] [flink] Make DPP distribute the splits fairly for flink [paimon]
HuangXingBo opened a new pull request, #4348:
URL: https://github.com/apache/paimon/pull/4348
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
The existing DPP assigner implementation first assigns fairly and then assigns according to DPP, which may result in uneven splits for different tasks.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Make DPP distribute the splits fairly for flink [paimon]
Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on code in PR #4348:
URL: https://github.com/apache/paimon/pull/4348#discussion_r1807152039
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/assigners/DynamicPartitionPruningPreAssignSplitAssigner.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.paimon.flink.source.assigners;
+
+import org.apache.paimon.codegen.Projection;
+import org.apache.paimon.data.BinaryRow;
+import org.apache.paimon.flink.FlinkRowData;
+import org.apache.paimon.flink.source.FileStoreSourceSplit;
+import org.apache.paimon.table.source.DataSplit;
+
+import org.apache.flink.table.connector.source.DynamicFilteringData;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * Pre-calculate which splits each task should process by given {@link DynamicFilteringData}, and
+ * then distribute the splits fairly.
+ */
+public class DynamicPartitionPruningPreAssignSplitAssigner extends PreAssignSplitAssigner {
Review Comment:
May be this class doesn't need.
You could move filter logic to PreAssignSplitAssigner.
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/assigners/DynamicPartitionPruningPreAssignSplitAssigner.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.paimon.flink.source.assigners;
+
+import org.apache.paimon.codegen.Projection;
+import org.apache.paimon.data.BinaryRow;
+import org.apache.paimon.flink.FlinkRowData;
+import org.apache.paimon.flink.source.FileStoreSourceSplit;
+import org.apache.paimon.table.source.DataSplit;
+
+import org.apache.flink.table.connector.source.DynamicFilteringData;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * Pre-calculate which splits each task should process by given {@link DynamicFilteringData}, and
+ * then distribute the splits fairly.
+ */
+public class DynamicPartitionPruningPreAssignSplitAssigner extends PreAssignSplitAssigner {
+ public DynamicPartitionPruningPreAssignSplitAssigner(
+ int splitBatchSize,
+ int parallelism,
+ Collection<FileStoreSourceSplit> splits,
+ Projection partitionRowProjection,
+ DynamicFilteringData dynamicFilteringData) {
+ super(
+ splitBatchSize,
+ parallelism,
+ splits.stream()
+ .filter(s -> filter(partitionRowProjection, dynamicFilteringData, s))
+ .collect(Collectors.toList()));
+ }
+
+ private static boolean filter(
Review Comment:
Change DynamicPartitionPruningAssigner#filter to public static, and then delete DynamicPartitionPruningPreAssignSplitAssigner#filter?
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/assigners/DynamicPartitionPruningPreAssignSplitAssigner.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.paimon.flink.source.assigners;
+
+import org.apache.paimon.codegen.Projection;
+import org.apache.paimon.data.BinaryRow;
+import org.apache.paimon.flink.FlinkRowData;
+import org.apache.paimon.flink.source.FileStoreSourceSplit;
+import org.apache.paimon.table.source.DataSplit;
+
+import org.apache.flink.table.connector.source.DynamicFilteringData;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * Pre-calculate which splits each task should process by given {@link DynamicFilteringData}, and
+ * then distribute the splits fairly.
+ */
+public class DynamicPartitionPruningPreAssignSplitAssigner extends PreAssignSplitAssigner {
+ public DynamicPartitionPruningPreAssignSplitAssigner(
Review Comment:
add a blank line
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/assigners/DynamicPartitionPruningPreAssignSplitAssigner.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.paimon.flink.source.assigners;
+
+import org.apache.paimon.codegen.Projection;
+import org.apache.paimon.data.BinaryRow;
+import org.apache.paimon.flink.FlinkRowData;
+import org.apache.paimon.flink.source.FileStoreSourceSplit;
+import org.apache.paimon.table.source.DataSplit;
+
+import org.apache.flink.table.connector.source.DynamicFilteringData;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * Pre-calculate which splits each task should process by given {@link DynamicFilteringData}, and
+ * then distribute the splits fairly.
+ */
+public class DynamicPartitionPruningPreAssignSplitAssigner extends PreAssignSplitAssigner {
+ public DynamicPartitionPruningPreAssignSplitAssigner(
+ int splitBatchSize,
+ int parallelism,
+ Collection<FileStoreSourceSplit> splits,
+ Projection partitionRowProjection,
+ DynamicFilteringData dynamicFilteringData) {
+ super(
+ splitBatchSize,
+ parallelism,
+ splits.stream()
+ .filter(s -> filter(partitionRowProjection, dynamicFilteringData, s))
+ .collect(Collectors.toList()));
+ }
+
+ private static boolean filter(
Review Comment:
why static?
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Make DPP distribute the splits fairly for flink [paimon]
Posted by "yuzelin (via GitHub)" <gi...@apache.org>.
yuzelin merged PR #4348:
URL: https://github.com/apache/paimon/pull/4348
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org