yjshen commented on a change in pull request #2029:
URL: https://github.com/apache/arrow-datafusion/pull/2029#discussion_r830587971



##########
File path: datafusion/src/execution/context.rs
##########
@@ -846,39 +773,14 @@ pub struct SessionConfig {
     /// parallel using the provided `target_partitions` level
     pub repartition_windows: bool,
     /// Should DataFusion parquet reader using the predicate to prune data
-    parquet_pruning: bool,
-    /// Runtime configurations such as memory threshold and local disk for 
spill
-    pub runtime: RuntimeConfig,
+    pub parquet_pruning: bool,

Review comment:
       How about this one, to avoid having a SessionConfig and a HashMap.
   
   ```rust
   
   #[derive(Clone, Debug)]
   enum Value {
       USIZE(usize),
       STRING(String),
       BOOL(bool),
   }
   
   impl Value {
       fn into_usize(&self) -> Result<usize> {
           if let Value::USIZE(u) = self {
               Ok(*u)
           } else {
               Err(DataFusionError::Internal(format!("{:?} not a usize conf", 
self)))
           }
       }
   
       fn into_string(&self) -> Result<String> {
           if let Value::STRING(s) = self {
               Ok(s.to_owned())
           } else {
               Err(DataFusionError::Internal(format!("{:?} not a string conf", 
self)))
           }
       }
   }
   
   struct TaskProperties {
       pub inner: HashMap<String, Value>,
   }
   
   impl TaskProperties {
       /// setters
       fn set_usize(&mut self, key: impl Into<String>, value: usize) {
           self.inner.insert(key.into(), Value::USIZE(value));
       }
   
       fn set_bool(&mut self, key: impl Into<String>, value: bool) {
           self.inner.insert(key.into(), Value::BOOL(value));
       }
   
       /// getters
       fn get_usize(&self, key: &str, default: usize) -> usize {
           self.inner.get(key).and_then(|x| 
x.into_usize().ok()).unwrap_or(default)
       }
   
       /// known conf fast passes
       fn batch_size(&self) -> usize {
           self.get_usize("target_batch_size", 10240)
       }
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to