You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "leaves12138 (via GitHub)" <gi...@apache.org> on 2025/08/07 07:20:19 UTC
[PR] [WIP][core] Enabled field merge read in row-tracking table [paimon]
leaves12138 opened a new pull request, #6038:
URL: https://github.com/apache/paimon/pull/6038
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
Enable merge field read if DataFileMetas (APPEND kind) have the same firstRowId.
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 commented on code in PR #6038:
URL: https://github.com/apache/paimon/pull/6038#discussion_r2261997012
##########
paimon-core/src/main/java/org/apache/paimon/io/RowDataFileWriter.java:
##########
@@ -117,6 +120,7 @@ public DataFileMeta result() throws IOException {
fileSource,
statsPair.getKey(),
externalPath,
- null);
+ null,
+ fieldIds);
Review Comment:
OK
##########
paimon-core/src/main/java/org/apache/paimon/io/DataFileMeta.java:
##########
@@ -128,6 +130,8 @@ public class DataFileMeta {
private final @Nullable Long firstRowId;
+ private final @Nullable int[] fieldIds;
Review Comment:
OK
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #6038:
URL: https://github.com/apache/paimon/pull/6038#issuecomment-3169976501
Looks good to me!
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 commented on PR #6038:
URL: https://github.com/apache/paimon/pull/6038#issuecomment-3167052063
> Maybe we should introduce a new option: `data-evolution.enabled`.
OK
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6038:
URL: https://github.com/apache/paimon/pull/6038#discussion_r2262006472
##########
paimon-core/src/main/java/org/apache/paimon/table/source/RowLineageSplitGenerator.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.table.source;
+
+import org.apache.paimon.io.DataFileMeta;
+import org.apache.paimon.utils.BinPacking;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.ToLongFunction;
+import java.util.stream.Collectors;
+
+/** Append only implementation of {@link SplitGenerator}. */
+public class RowLineageSplitGenerator implements SplitGenerator {
+
+ private final long targetSplitSize;
+ private final long openFileCost;
+
+ public RowLineageSplitGenerator(long targetSplitSize, long openFileCost) {
+ this.targetSplitSize = targetSplitSize;
+ this.openFileCost = openFileCost;
+ }
+
+ @Override
+ public boolean alwaysRawConvertible() {
+ return true;
+ }
+
+ @Override
+ public List<SplitGroup> splitForBatch(List<DataFileMeta> input) {
+ List<List<DataFileMeta>> files = split(input);
+ Function<List<DataFileMeta>, Long> weightFunc =
+ file ->
+ Math.max(
+ file.stream().mapToLong(DataFileMeta::fileSize).sum(),
+ openFileCost);
+ return BinPacking.packForOrdered(files, weightFunc, targetSplitSize).stream()
+ .flatMap(Collection::stream)
+ .map(SplitGroup::rawConvertibleGroup)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public List<SplitGroup> splitForStreaming(List<DataFileMeta> files) {
+ return splitForBatch(files);
+ }
+
+ public static List<List<DataFileMeta>> split(List<DataFileMeta> files) {
+ List<List<DataFileMeta>> splitByRowId = new ArrayList<>();
+ // Sort files by firstRowId and then by maxSequenceNumber
+ files.sort(
+ Comparator.comparingLong(
+ (ToLongFunction<DataFileMeta>)
+ value ->
+ value.firstRowId() == null
+ ? Long.MIN_VALUE
+ : value.firstRowId())
+ .thenComparing(
+ (f1, f2) -> {
+ // If firstRowId is the same, we should read the file with
+ // larger sequence number first. Because larger sequence number
+ // file is more fresh
+ return Long.compare(
+ f2.maxSequenceNumber(), f1.maxSequenceNumber());
+ }));
+
+ // Split files by firstRowId
+ long lastRowId = -1;
Review Comment:
Should throw exception for exception case.
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #6038:
URL: https://github.com/apache/paimon/pull/6038
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6038:
URL: https://github.com/apache/paimon/pull/6038#discussion_r2261884446
##########
paimon-core/src/main/java/org/apache/paimon/io/RowDataFileWriter.java:
##########
@@ -117,6 +120,7 @@ public DataFileMeta result() throws IOException {
fileSource,
statsPair.getKey(),
externalPath,
- null);
+ null,
+ fieldIds);
Review Comment:
Null if writing all fields.
Be careful for the table without this feature enabled.
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6038:
URL: https://github.com/apache/paimon/pull/6038#discussion_r2261885599
##########
paimon-core/src/main/java/org/apache/paimon/io/DataFileMeta.java:
##########
@@ -128,6 +130,8 @@ public class DataFileMeta {
private final @Nullable Long firstRowId;
+ private final @Nullable int[] fieldIds;
Review Comment:
`String[] _WRITE_COLS`?
--
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] [core] Enabled field merge read in row-tracking table [paimon]
Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 commented on code in PR #6038:
URL: https://github.com/apache/paimon/pull/6038#discussion_r2262039897
##########
paimon-core/src/main/java/org/apache/paimon/table/source/RowLineageSplitGenerator.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.table.source;
+
+import org.apache.paimon.io.DataFileMeta;
+import org.apache.paimon.utils.BinPacking;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.ToLongFunction;
+import java.util.stream.Collectors;
+
+/** Append only implementation of {@link SplitGenerator}. */
+public class RowLineageSplitGenerator implements SplitGenerator {
+
+ private final long targetSplitSize;
+ private final long openFileCost;
+
+ public RowLineageSplitGenerator(long targetSplitSize, long openFileCost) {
+ this.targetSplitSize = targetSplitSize;
+ this.openFileCost = openFileCost;
+ }
+
+ @Override
+ public boolean alwaysRawConvertible() {
+ return true;
+ }
+
+ @Override
+ public List<SplitGroup> splitForBatch(List<DataFileMeta> input) {
+ List<List<DataFileMeta>> files = split(input);
+ Function<List<DataFileMeta>, Long> weightFunc =
+ file ->
+ Math.max(
+ file.stream().mapToLong(DataFileMeta::fileSize).sum(),
+ openFileCost);
+ return BinPacking.packForOrdered(files, weightFunc, targetSplitSize).stream()
+ .flatMap(Collection::stream)
+ .map(SplitGroup::rawConvertibleGroup)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public List<SplitGroup> splitForStreaming(List<DataFileMeta> files) {
+ return splitForBatch(files);
+ }
+
+ public static List<List<DataFileMeta>> split(List<DataFileMeta> files) {
+ List<List<DataFileMeta>> splitByRowId = new ArrayList<>();
+ // Sort files by firstRowId and then by maxSequenceNumber
+ files.sort(
+ Comparator.comparingLong(
+ (ToLongFunction<DataFileMeta>)
+ value ->
+ value.firstRowId() == null
+ ? Long.MIN_VALUE
+ : value.firstRowId())
+ .thenComparing(
+ (f1, f2) -> {
+ // If firstRowId is the same, we should read the file with
+ // larger sequence number first. Because larger sequence number
+ // file is more fresh
+ return Long.compare(
+ f2.maxSequenceNumber(), f1.maxSequenceNumber());
+ }));
+
+ // Split files by firstRowId
+ long lastRowId = -1;
Review Comment:
OK
--
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