This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 8e765e70 fix(schema): list persisted schemas independently of catalog
cache (#1260)
8e765e70 is described below
commit 8e765e70593e518a6a131fccf236618b4e958a03
Author: XiaoHongbo <[email protected]>
AuthorDate: Sat Oct 31 10:43:05 2026 +0800
fix(schema): list persisted schemas independently of catalog cache (#1260)
---
crates/paimon/src/table/schema_manager.rs | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/crates/paimon/src/table/schema_manager.rs
b/crates/paimon/src/table/schema_manager.rs
index 02e8d43f..96fdb13f 100644
--- a/crates/paimon/src/table/schema_manager.rs
+++ b/crates/paimon/src/table/schema_manager.rs
@@ -132,7 +132,10 @@ impl SchemaManager {
/// Mirrors Java
[SchemaManager.listAll()](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java).
pub async fn list_all(&self) -> crate::Result<Vec<Arc<TableSchema>>> {
let ids = self.list_all_ids().await?;
- try_join_all(ids.into_iter().map(|id| self.schema(id))).await
+ // Catalog-resolved schemas can have synthetic timestamps. Enumerated
+ // schema files are authoritative for the persisted schema history.
+ let stored = Self::new(self.file_io.clone(), self.table_path.clone());
+ try_join_all(ids.into_iter().map(|id| stored.schema(id))).await
}
/// Return the schema with the highest id, or `None` when no schema files
@@ -272,6 +275,31 @@ mod tests {
assert_eq!(ids, vec![0, 1, 2]);
}
+ #[tokio::test]
+ async fn list_all_reads_persisted_schema_after_catalog_cache_seed() {
+ let file_io = memory_file_io();
+ let path = "memory:/persisted_schema";
+ let sm = SchemaManager::new(file_io.clone(), path.to_string());
+ let schema = Schema::builder().build().unwrap();
+ let mut stored = serde_json::to_value(TableSchema::new(0,
&schema)).unwrap();
+ stored["timeMillis"] = serde_json::json!(1234);
+ file_io
+ .new_output(&sm.schema_path(0))
+ .unwrap()
+ .write(Bytes::from(serde_json::to_vec(&stored).unwrap()))
+ .await
+ .unwrap();
+ let mut resolved = stored.clone();
+ resolved["timeMillis"] = serde_json::json!(5678);
+ sm.cache_resolved_schema(serde_json::from_value(resolved).unwrap());
+
+ assert_eq!(sm.schema(0).await.unwrap().time_millis(), 5678);
+ let schemas = sm.list_all().await.unwrap();
+ assert_eq!(schemas.len(), 1);
+ assert_eq!(schemas[0].time_millis(), 1234);
+ assert_eq!(sm.schema(0).await.unwrap().time_millis(), 5678);
+ }
+
#[tokio::test]
async fn latest_returns_none_when_no_schemas() {
let file_io = memory_file_io();