This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 66752048ce Make ArrayFormatterFactory Send + Sync and add a test 
(#8878)
66752048ce is described below

commit 66752048ced2903dde4e748b065078467a2c9d92
Author: Tobias Schwarzinger <[email protected]>
AuthorDate: Wed Nov 19 17:32:58 2025 +0100

    Make ArrayFormatterFactory Send + Sync and add a test (#8878)
    
    # Which issue does this PR close?
    
    - Closes #8875 .
    
    Ping @alamb
    
    # Rationale for this change
    
    `FormatOptions` is no longer `Send` and `Sync`.
    
    # What changes are included in this PR?
    
    - Require `Send` + `Sync` for `ArrayFormatterFactory`
    - Assertion that `FormatOptions` is `Send` + `Sync`
    
    # Are these changes tested?
    
    - Yes
    
    # Are there any user-facing changes?
    
    Yes, should fix the compiler error. I could compile DataFusion with the
    following patch adapted from the issue:
    
    ```
    ## Temporary arrow-rs patch until 57.1.0 is released
    
    [patch.crates-io]
    arrow = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-array = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-buffer = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-cast = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-data = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-ipc = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-schema = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-select = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-string = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-ord = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    arrow-flight = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    parquet = { git = "https://github.com/tobixdev/arrow-rs.git";, branch = 
"custom-formatters" }
    ```
---
 arrow-cast/src/display.rs | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arrow-cast/src/display.rs b/arrow-cast/src/display.rs
index 6fd454d2fb..d58001ded7 100644
--- a/arrow-cast/src/display.rs
+++ b/arrow-cast/src/display.rs
@@ -352,7 +352,7 @@ impl<'a> FormatOptions<'a> {
 ///        &FormatOptions::new().with_formatter_factory(Some(&MyFormatters {}))
 /// );
 /// ```
-pub trait ArrayFormatterFactory: Debug {
+pub trait ArrayFormatterFactory: Debug + Send + Sync {
     /// Creates a new [`ArrayFormatter`] for the given [`Array`] and an 
optional [`Field`]. If the
     /// default implementation should be used, return [`None`].
     ///
@@ -1340,6 +1340,19 @@ mod tests {
         assert_eq!(TEST_CONST_OPTIONS.date_format, Some("foo"));
     }
 
+    /// See https://github.com/apache/arrow-rs/issues/8875
+    #[test]
+    fn test_options_send_sync() {
+        fn assert_send_sync<T>()
+        where
+            T: Send + Sync,
+        {
+            // nothing – the compiler does the work
+        }
+
+        assert_send_sync::<FormatOptions<'static>>();
+    }
+
     #[test]
     fn test_map_array_to_string() {
         let keys = vec!["a", "b", "c", "d", "e", "f", "g", "h"];

Reply via email to