Skip to content

Commit 1ef11c6

Browse files
committed
升级paimon 1.2.0
1 parent d99d1eb commit 1ef11c6

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonMetadata.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import com.starrocks.sql.optimizer.statistics.Statistics;
5050
import org.apache.logging.log4j.LogManager;
5151
import org.apache.logging.log4j.Logger;
52+
import org.apache.paimon.Snapshot;
5253
import org.apache.paimon.catalog.CachingCatalog;
5354
import org.apache.paimon.catalog.Catalog;
5455
import org.apache.paimon.catalog.Identifier;
@@ -276,10 +277,11 @@ public boolean tableExists(ConnectContext context, String dbName, String tableNa
276277
public List<RemoteFileInfo> getRemoteFiles(Table table, GetRemoteFilesParams params) {
277278
RemoteFileInfo remoteFileInfo = new RemoteFileInfo();
278279
PaimonTable paimonTable = (PaimonTable) table;
280+
Optional<Snapshot> latestSnapshotOptional = paimonTable.getNativeTable().latestSnapshot();
279281
long latestSnapshotId = -1L;
280282
try {
281-
if (paimonTable.getNativeTable().latestSnapshotId().isPresent()) {
282-
latestSnapshotId = paimonTable.getNativeTable().latestSnapshotId().getAsLong();
283+
if (latestSnapshotOptional.isPresent()) {
284+
latestSnapshotId = latestSnapshotOptional.get().id();
283285
}
284286
} catch (Exception e) {
285287
// System table does not have snapshotId, ignore it.
@@ -300,7 +302,7 @@ public List<RemoteFileInfo> getRemoteFiles(Table table, GetRemoteFilesParams par
300302
}
301303
InnerTableScan scan = (InnerTableScan) readBuilder.newScan();
302304
PaimonMetricRegistry paimonMetricRegistry = new PaimonMetricRegistry();
303-
List<Split> splits = scan.withMetricsRegistry(paimonMetricRegistry).plan().splits();
305+
List<Split> splits = scan.withMetricRegistry(paimonMetricRegistry).plan().splits();
304306
traceScanMetrics(paimonMetricRegistry, splits, table.getCatalogTableName(), predicates);
305307

306308
PaimonSplitsInfo paimonSplitsInfo = new PaimonSplitsInfo(predicates, splits);

fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonMetricRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
import java.util.Map;
2323

24-
public class PaimonMetricRegistry extends MetricRegistry {
24+
public class PaimonMetricRegistry implements MetricRegistry {
2525
private MetricGroup metricGroup;
2626

2727
@Override
28-
protected MetricGroup createMetricGroup(String groupName, Map<String, String> variables) {
28+
public MetricGroup createMetricGroup(String groupName, Map<String, String> variables) {
2929
MetricGroup metricGroup = new MetricGroupImpl(groupName, variables);
3030
this.metricGroup = metricGroup;
3131
return metricGroup;

fe/fe-core/src/test/java/com/starrocks/connector/paimon/PaimonMetadataTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import mockit.MockUp;
5757
import mockit.Mocked;
5858
import org.apache.paimon.CoreOptions;
59+
import org.apache.paimon.Snapshot;
5960
import org.apache.paimon.catalog.Catalog;
6061
import org.apache.paimon.catalog.CatalogContext;
6162
import org.apache.paimon.catalog.CatalogFactory;
@@ -241,7 +242,8 @@ public void testGetSystemTable(@Mocked ManifestsTable paimonSystemTable,
241242
{
242243
paimonNativeCatalog.getTable((Identifier) any);
243244
result = paimonSystemTable;
244-
paimonSystemTable.latestSnapshotId();
245+
Optional<Snapshot> latestSnapshotOptional = paimonSystemTable.latestSnapshot();
246+
latestSnapshotOptional.get().id();
245247
result = new Exception("Readonly Table tbl1$manifests does not support currentSnapshot.");
246248
paimonSystemTable.newReadBuilder();
247249
result = readBuilder;
@@ -267,9 +269,9 @@ public void testListPartitionNames(@Mocked FileStoreTable mockPaimonTable)
267269
));
268270
Identifier tblIdentifier = new Identifier("db1", "tbl1");
269271
org.apache.paimon.partition.Partition partition1 = new Partition(Map.of("year", "2020", "month", "1"),
270-
100L, 1L, 1L, 1741327322000L);
272+
100L, 1L, 1L, 1741327322000L, false);
271273
org.apache.paimon.partition.Partition partition2 = new Partition(Map.of("year", "2020", "month", "2"),
272-
100L, 1L, 1L, 1741327322000L);
274+
100L, 1L, 1L, 1741327322000L, false);
273275

274276
new Expectations() {
275277
{

fe/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ under the License.
6868
<dnsjava.version>3.6.3</dnsjava.version>
6969
<nimbusds.version>9.37.2</nimbusds.version>
7070
<protobuf-java.version>3.25.5</protobuf-java.version>
71-
<paimon.version>1.0.1</paimon.version>
71+
<paimon.version>1.2.0</paimon.version>
7272
<delta-kernel.version>4.0.0rc1</delta-kernel.version>
7373
<iceberg.version>1.9.0</iceberg.version>
7474
<staros.version>3.5-rc3</staros.version>

0 commit comments

Comments
 (0)