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 932a9b33 fix(arrow): list every writable format in the write-format 
error (#690)
932a9b33 is described below

commit 932a9b33871ffe53896cae0953dd9b845cc65018
Author: jackylee <[email protected]>
AuthorDate: Sat Aug 8 13:04:58 2026 +0800

    fix(arrow): list every writable format in the write-format error (#690)
---
 crates/paimon/src/arrow/format/mod.rs | 44 ++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/crates/paimon/src/arrow/format/mod.rs 
b/crates/paimon/src/arrow/format/mod.rs
index dde85a38..81f1876e 100644
--- a/crates/paimon/src/arrow/format/mod.rs
+++ b/crates/paimon/src/arrow/format/mod.rs
@@ -230,6 +230,16 @@ fn supported_read_formats() -> Vec<&'static str> {
     ]
 }
 
+fn supported_write_formats() -> Vec<&'static str> {
+    vec![
+        ".parquet",
+        ".blob",
+        ".row",
+        #[cfg(feature = "vortex")]
+        ".vortex",
+    ]
+}
+
 /// Create a format writer that streams directly to storage.
 pub(crate) async fn create_format_writer(
     output: &OutputFile,
@@ -277,7 +287,39 @@ pub(crate) async fn create_format_writer(
             ));
         }
         Err(Error::Unsupported {
-            message: format!("unsupported write format: expected .parquet, 
.row, got: {path}"),
+            message: format!(
+                "unsupported write format: expected {}, got: {path}",
+                supported_write_formats().join(", ")
+            ),
         })
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::io::FileIOBuilder;
+
+    #[tokio::test]
+    async fn create_format_writer_error_lists_every_supported_format() {
+        let file_io = FileIOBuilder::new("memory").build().unwrap();
+        let output = 
file_io.new_output("memory:/unsupported/data.csv").unwrap();
+        let schema = Arc::new(arrow_schema::Schema::empty());
+
+        let err = match create_format_writer(&output, schema, "zstd", 1, None, 
None, None).await {
+            Ok(_) => panic!("csv is not a writable format"),
+            Err(err) => err,
+        };
+
+        let Error::Unsupported { message } = err else {
+            panic!("expected Unsupported, got {err:?}");
+        };
+        for format in supported_write_formats() {
+            assert!(
+                message.contains(format),
+                "{format} missing from write-format error: {message}"
+            );
+        }
+        assert!(message.contains("data.csv"), "message: {message}");
+    }
+}

Reply via email to