You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by ji...@apache.org on 2025/08/25 09:29:18 UTC
(amoro) branch master updated (7e9edbf41 -> fbd1ee46d)
This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
from 7e9edbf41 [AMORO-3742] Fix errors in sql scripts (#3745)
new daa0c49a8 [AMORO-3734][Improvement]: Add operation/schemaId to Snapshot
new fbd1ee46d Addressed
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../main/java/org/apache/amoro/TableSnapshot.java | 6 +++++
.../amoro/formats/iceberg/IcebergSnapshot.java | 10 ++++++++
.../apache/amoro/formats/mixed/MixedSnapshot.java | 29 +++++++++++++++++++---
.../amoro/formats/paimon/PaimonSnapshot.java | 10 ++++++++
4 files changed, 51 insertions(+), 4 deletions(-)
(amoro) 01/02: [AMORO-3734][Improvement]: Add operation/schemaId to Snapshot
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
commit daa0c49a83f2d768d488acbf53225812bd410c34
Author: xuyu <11...@vivo.com>
AuthorDate: Tue Aug 19 10:34:25 2025 +0800
[AMORO-3734][Improvement]: Add operation/schemaId to Snapshot
---
.../main/java/org/apache/amoro/TableSnapshot.java | 6 +++++
.../amoro/formats/iceberg/IcebergSnapshot.java | 10 ++++++++
.../apache/amoro/formats/mixed/MixedSnapshot.java | 29 +++++++++++++++++++---
.../amoro/formats/paimon/PaimonSnapshot.java | 10 ++++++++
4 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/amoro-common/src/main/java/org/apache/amoro/TableSnapshot.java b/amoro-common/src/main/java/org/apache/amoro/TableSnapshot.java
index 2ed1b1030..f57c34746 100644
--- a/amoro-common/src/main/java/org/apache/amoro/TableSnapshot.java
+++ b/amoro-common/src/main/java/org/apache/amoro/TableSnapshot.java
@@ -28,4 +28,10 @@ public interface TableSnapshot {
/** Returns the id of this snapshot. */
String id();
+
+ /** Returns the operation of this snapshot. */
+ String operation();
+
+ /** Returns the schema id of this snapshot. */
+ long schemaId();
}
diff --git a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/IcebergSnapshot.java b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/IcebergSnapshot.java
index e90fd6eab..4751e754f 100644
--- a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/IcebergSnapshot.java
+++ b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/IcebergSnapshot.java
@@ -43,6 +43,16 @@ public class IcebergSnapshot implements TableSnapshot {
return String.valueOf(snapshot.snapshotId());
}
+ @Override
+ public String operation() {
+ return snapshot.operation();
+ }
+
+ @Override
+ public long schemaId() {
+ return snapshot.schemaId();
+ }
+
public Snapshot icebergSnapshot() {
return snapshot;
}
diff --git a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java
index 2059d2567..e207e5e29 100644
--- a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java
+++ b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java
@@ -42,10 +42,15 @@ public class MixedSnapshot implements TableSnapshot {
@Override
public long commitTime() {
- Long changCommit =
- Optional.ofNullable(changeSnapshot).map(Snapshot::timestampMillis).orElse(-1L);
- Long baseCommit = Optional.ofNullable(baseSnapshot).map(Snapshot::timestampMillis).orElse(-1L);
- return Longs.max(changCommit, baseCommit);
+ return Longs.max(getChangeCommit(), getBaseCommit());
+ }
+
+ public long getChangeCommit() {
+ return Optional.ofNullable(changeSnapshot).map(Snapshot::timestampMillis).orElse(-1L);
+ }
+
+ public long getBaseCommit() {
+ return Optional.ofNullable(baseSnapshot).map(Snapshot::timestampMillis).orElse(-1L);
}
public Snapshot getChangeSnapshot() {
@@ -68,4 +73,20 @@ public class MixedSnapshot implements TableSnapshot {
public String id() {
return changeSnapshot + "_" + baseSnapshot;
}
+
+ @Override
+ public String operation() {
+ if (getChangeCommit() >= getBaseCommit()) {
+ return changeSnapshot.operation();
+ }
+ return baseSnapshot.operation();
+ }
+
+ @Override
+ public long schemaId() {
+ if (getChangeCommit() >= getBaseCommit()) {
+ return changeSnapshot.schemaId();
+ }
+ return baseSnapshot.schemaId();
+ }
}
diff --git a/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonSnapshot.java b/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonSnapshot.java
index 52c0a369d..cd28ced67 100644
--- a/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonSnapshot.java
+++ b/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonSnapshot.java
@@ -44,4 +44,14 @@ public class PaimonSnapshot implements TableSnapshot {
public String id() {
return String.valueOf(snapshot.id());
}
+
+ @Override
+ public String operation() {
+ return snapshot.commitKind().toString();
+ }
+
+ @Override
+ public long schemaId() {
+ return snapshot.schemaId();
+ }
}
(amoro) 02/02: Addressed
Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
commit fbd1ee46d6d26d834064ace4cffe0abaf2b54449
Author: xuyu <11...@vivo.com>
AuthorDate: Tue Aug 19 16:36:28 2025 +0800
Addressed
---
.../src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java
index e207e5e29..9f0ac67c2 100644
--- a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java
+++ b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/mixed/MixedSnapshot.java
@@ -45,11 +45,11 @@ public class MixedSnapshot implements TableSnapshot {
return Longs.max(getChangeCommit(), getBaseCommit());
}
- public long getChangeCommit() {
+ private long getChangeCommit() {
return Optional.ofNullable(changeSnapshot).map(Snapshot::timestampMillis).orElse(-1L);
}
- public long getBaseCommit() {
+ private long getBaseCommit() {
return Optional.ofNullable(baseSnapshot).map(Snapshot::timestampMillis).orElse(-1L);
}