Skip to content

Commit 07e3e9a

Browse files
authored
[core] add data-evolution info to Files System Table. (#6986)
1 parent 470b381 commit 07e3e9a

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

paimon-core/src/main/java/org/apache/paimon/table/system/FilesTable.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.paimon.casting.CastExecutors;
2323
import org.apache.paimon.data.BinaryRow;
2424
import org.apache.paimon.data.BinaryString;
25+
import org.apache.paimon.data.GenericArray;
2526
import org.apache.paimon.data.GenericRow;
2627
import org.apache.paimon.data.InternalArray;
2728
import org.apache.paimon.data.InternalRow;
@@ -117,7 +118,9 @@ public class FilesTable implements ReadonlyTable {
117118
new DataField(14, "max_sequence_number", new BigIntType(true)),
118119
new DataField(15, "creation_time", DataTypes.TIMESTAMP_MILLIS()),
119120
new DataField(16, "deleteRowCount", DataTypes.BIGINT()),
120-
new DataField(17, "file_source", DataTypes.STRING())));
121+
new DataField(17, "file_source", DataTypes.STRING()),
122+
new DataField(18, "first_row_id", DataTypes.BIGINT()),
123+
new DataField(19, "write_cols", DataTypes.ARRAY(DataTypes.STRING()))));
121124

122125
private final FileStoreTable storeTable;
123126

@@ -435,7 +438,16 @@ private LazyGenericRow toRow(
435438
() -> file.deleteRowCount().orElse(null),
436439
() ->
437440
BinaryString.fromString(
438-
file.fileSource().map(FileSource::toString).orElse(null))
441+
file.fileSource().map(FileSource::toString).orElse(null)),
442+
file::firstRowId,
443+
() -> {
444+
List<String> writeCols = file.writeCols();
445+
if (writeCols == null) {
446+
return null;
447+
}
448+
return new GenericArray(
449+
writeCols.stream().map(BinaryString::fromString).toArray());
450+
},
439451
};
440452

441453
return new LazyGenericRow(fields);

paimon-core/src/test/java/org/apache/paimon/table/system/FilesTableTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ private List<InternalRow> getExpectedResult(long snapshotId) {
222222
file.creationTime(),
223223
file.deleteRowCount().orElse(null),
224224
BinaryString.fromString(
225-
file.fileSource().map(Object::toString).orElse(null))));
225+
file.fileSource().map(Object::toString).orElse(null)),
226+
file.firstRowId(),
227+
null));
226228
}
227229
return expectedRow;
228230
}

0 commit comments

Comments
 (0)