diff --git a/docs/content/maintenance/system-tables.md b/docs/content/maintenance/system-tables.md index 75798130a6df0..0246d6faf8dc5 100644 --- a/docs/content/maintenance/system-tables.md +++ b/docs/content/maintenance/system-tables.md @@ -414,13 +414,13 @@ the update before and update after will be packed in one row. ``` /* +------------------+----------------------+-----------------------+ -| rowkind | column_0 | column_1 | +| rowkind | column_0 | column_1 | +------------------+----------------------+-----------------------+ -| +I | [col_0, null] | [col_1, null] | +| +I | [col_0] | [col_1] | +------------------+----------------------+-----------------------+ | +U | [col_0_ub, col_0_ua] | [col_1_ub, col_1_ua] | +------------------+----------------------+-----------------------+ -| -D | [col_0, null] | [col_1, null] | +| -D | [col_0] | [col_1] | +------------------+----------------------+-----------------------+ */ ``` diff --git a/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java b/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java index 25f50d2081e30..f12e20152da51 100644 --- a/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java +++ b/paimon-core/src/main/java/org/apache/paimon/table/system/BinlogTable.java @@ -165,11 +165,13 @@ private InternalRow convertToArray( GenericRow row = new GenericRow(row1.getFieldCount()); for (int i = 0; i < row1.getFieldCount(); i++) { Object o1 = fieldGetters[i].getFieldOrNull(row1); - Object o2 = null; + Object o2; if (row2 != null) { o2 = fieldGetters[i].getFieldOrNull(row2); + row.setField(i, new GenericArray(new Object[] {o1, o2})); + } else { + row.setField(i, new GenericArray(new Object[] {o1})); } - row.setField(i, new GenericArray(new Object[] {o1, o2})); } // If no row2 provided, then follow the row1 kind. if (row2 == null) { diff --git a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/SystemTableITCase.java b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/SystemTableITCase.java index 68629d9fbaecc..771f4acc5e585 100644 --- a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/SystemTableITCase.java +++ b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/SystemTableITCase.java @@ -43,9 +43,9 @@ public void testBinlogTableStreamRead() throws Exception { List rows = iterator.collect(3); assertThat(rows) .containsExactly( - Row.of("+I", new Integer[] {1, null}, new Integer[] {2, null}), + Row.of("+I", new Integer[] {1}, new Integer[] {2}), Row.of("+U", new Integer[] {1, 1}, new Integer[] {2, 3}), - Row.of("+I", new Integer[] {2, null}, new Integer[] {2, null})); + Row.of("+I", new Integer[] {2}, new Integer[] {2})); iterator.close(); } @@ -60,7 +60,7 @@ public void testBinlogTableBatchRead() throws Exception { List rows = sql("SELECT * FROM T$binlog /*+ OPTIONS('scan.mode' = 'latest') */"); assertThat(rows) .containsExactly( - Row.of("+I", new Integer[] {1, null}, new Integer[] {3, null}), - Row.of("+I", new Integer[] {2, null}, new Integer[] {2, null})); + Row.of("+I", new Integer[] {1}, new Integer[] {3}), + Row.of("+I", new Integer[] {2}, new Integer[] {2})); } }