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

nju_yaho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 97ff3458d Print the configurations of ConfigOptions in an ordered way 
so that we can directly compare the equality of two ConfigOptions by their 
debug strings (#3953)
97ff3458d is described below

commit 97ff3458db1b1ab57071f395083c88b91b81aa13
Author: yahoNanJing <[email protected]>
AuthorDate: Wed Oct 26 10:47:36 2022 +0800

    Print the configurations of ConfigOptions in an ordered way so that we can 
directly compare the equality of two ConfigOptions by their debug strings 
(#3953)
    
    Co-authored-by: yangzhong <[email protected]>
---
 datafusion/core/src/config.rs | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/datafusion/core/src/config.rs b/datafusion/core/src/config.rs
index e058f5c72..d124fd94f 100644
--- a/datafusion/core/src/config.rs
+++ b/datafusion/core/src/config.rs
@@ -22,8 +22,9 @@ use datafusion_common::ScalarValue;
 use itertools::Itertools;
 use log::warn;
 use parking_lot::RwLock;
-use std::collections::HashMap;
+use std::collections::{BTreeMap, HashMap};
 use std::env;
+use std::fmt::{Debug, Formatter};
 use std::sync::Arc;
 
 /// Configuration option "datafusion.optimizer.filter_null_join_keys"
@@ -274,11 +275,23 @@ impl BuiltInConfigs {
 }
 
 /// Configuration options struct. This can contain values for built-in and 
custom options
-#[derive(Debug, Clone)]
+#[derive(Clone)]
 pub struct ConfigOptions {
     options: HashMap<String, ScalarValue>,
 }
 
+/// Print the configurations in an ordered way so that we can directly compare 
the equality of two ConfigOptions by their debug strings
+impl Debug for ConfigOptions {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("ConfigOptions")
+            .field(
+                "options",
+                &format!("{:?}", BTreeMap::from_iter(self.options.iter())),
+            )
+            .finish()
+    }
+}
+
 impl Default for ConfigOptions {
     fn default() -> Self {
         Self::new()

Reply via email to