2010YOUY01 commented on code in PR #599: URL: https://github.com/apache/sedona-db/pull/599#discussion_r2796503566
########## rust/sedona/src/memory_pool.rs: ########## @@ -0,0 +1,279 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use datafusion::execution::memory_pool::{ + MemoryConsumer, MemoryLimit, MemoryPool, MemoryReservation, +}; +use datafusion_common::{resources_datafusion_err, DataFusionError, Result}; +use parking_lot::Mutex; + +pub const DEFAULT_UNSPILLABLE_RESERVE_RATIO: f64 = 0.2; + +/// A [`MemoryPool`] implementation similar to DataFusion's [`datafusion::execution::memory_pool::FairSpillPool`], +/// but with the following changes: +/// +/// It implements a reservation mechanism for unspillable memory consumers. This addresses an issue Review Comment: ```suggestion /// Spillable and non-spillable operators use logically separate portions of the memory pool, /// controlled by unspillable_reserve_ratio, instead of sharing a single pool as in /// DataFusion’s default FairSpillPool, which can lead to the following issues: ``` I’m trying to explain the “what” before the “why.” -- 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]
