Kontinuation commented on code in PR #608:
URL: https://github.com/apache/sedona-db/pull/608#discussion_r2816870309


##########
python/sedonadb/src/context.rs:
##########
@@ -39,15 +47,59 @@ pub struct InternalContext {
 #[pymethods]
 impl InternalContext {
     #[new]
-    fn new(py: Python) -> Result<Self, PySedonaError> {
+    #[pyo3(signature = (memory_limit=None, temp_dir=None, 
memory_pool_type=None, unspillable_reserve_ratio=None))]
+    fn new(
+        py: Python,
+        memory_limit: Option<usize>,
+        temp_dir: Option<String>,
+        memory_pool_type: Option<String>,
+        unspillable_reserve_ratio: Option<f64>,
+    ) -> Result<Self, PySedonaError> {
         let runtime = tokio::runtime::Builder::new_multi_thread()
             .enable_all()
             .build()
             .map_err(|e| {
                 PySedonaError::SedonaPython(format!("Failed to build 
multithreaded runtime: {e}"))
             })?;
 
-        let inner = wait_for_future(py, &runtime, 
SedonaContext::new_local_interactive())??;
+        let mut rt_builder = RuntimeEnvBuilder::new();
+        if let Some(memory_limit) = memory_limit {
+            let pool_type: PoolType = memory_pool_type
+                .as_deref()
+                .unwrap_or("fair")
+                .parse()
+                .map_err(|e: String| PySedonaError::SedonaPython(e))?;
+            let track_capacity = NonZeroUsize::new(10).expect("track capacity 
must be non-zero");
+            let pool: Arc<dyn MemoryPool> = match pool_type {
+                PoolType::Fair => {
+                    let unspillable_reserve =
+                        
unspillable_reserve_ratio.unwrap_or(DEFAULT_UNSPILLABLE_RESERVE_RATIO);

Review Comment:
   We have revamped the implementation so this is not relevant



##########
python/sedonadb/python/sedonadb/context.py:
##########
@@ -49,8 +49,16 @@ class SedonaContext:
         └───────┘
     """
 
-    def __init__(self):
-        self._impl = InternalContext()
+    def __init__(
+        self,
+        memory_limit: Optional[int] = None,
+        temp_dir: Optional[str] = None,
+        memory_pool_type: Literal["greedy", "fair"] = "fair",
+        unspillable_reserve_ratio: Optional[float] = None,
+    ):
+        self._impl = InternalContext(
+            memory_limit, temp_dir, memory_pool_type, unspillable_reserve_ratio
+        )
         self.options = Options()

Review Comment:
   We have revamped the implementation so this is not relevant



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