erenavsarogullari commented on code in PR #20372:
URL: https://github.com/apache/datafusion/pull/20372#discussion_r2868453771


##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1236,33 +1236,38 @@ impl SessionContext {
         Ok(())
     }
 
-    /// Parse memory limit from string to number of bytes
+    /// Parse capacity limit from string to number of bytes by allowing units: 
K, M and G.
     /// Supports formats like '1.5G', '100M', '512K'
     ///
     /// # Examples
     /// ```
     /// use datafusion::execution::context::SessionContext;
     ///
     /// assert_eq!(
-    ///     SessionContext::parse_memory_limit("1M").unwrap(),
+    ///     
SessionContext::parse_capacity_limit("datafusion.runtime.memory_limit", 
"1M").unwrap(),
     ///     1024 * 1024
     /// );
     /// assert_eq!(
-    ///     SessionContext::parse_memory_limit("1.5G").unwrap(),
+    ///     
SessionContext::parse_capacity_limit("datafusion.runtime.memory_limit", 
"1.5G").unwrap(),
     ///     (1.5 * 1024.0 * 1024.0 * 1024.0) as usize
     /// );
     /// ```
-    pub fn parse_memory_limit(limit: &str) -> Result<usize> {
+    pub fn parse_capacity_limit(config_name: &str, limit: &str) -> 
Result<usize> {
         let (number, unit) = limit.split_at(limit.len() - 1);

Review Comment:
   `if limit.trim().is_empty() {}` can be more reliable by handling both 
`empty` and `blank` strings.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to