crepererum commented on code in PR #4406: URL: https://github.com/apache/arrow-datafusion/pull/4406#discussion_r1034338039
########## datafusion/core/tests/memory_limit.rs: ########## @@ -0,0 +1,112 @@ +// 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. + +//! This module contains tests for limiting memory at runtime in DataFusion + +use std::sync::Arc; + +use arrow::record_batch::RecordBatch; +use datafusion::datasource::MemTable; +use datafusion::execution::disk_manager::DiskManagerConfig; +use datafusion::execution::runtime_env::{RuntimeConfig, RuntimeEnv}; +use datafusion_common::assert_contains; + +use datafusion::prelude::{SessionConfig, SessionContext}; +use test_utils::{stagger_batch, AccessLogGenerator}; + +#[cfg(test)] +#[ctor::ctor] +fn init() { + let _ = env_logger::try_init(); +} + +#[tokio::test] +async fn oom_sort() { + run_limit_test( + "select * from t order by host DESC", + "Resources exhausted: Memory Exhausted while Sorting (DiskManager is disabled)", + ) + .await +} + +#[tokio::test] +async fn group_by_none() { + run_limit_test( + "select median(image) from t", + "Resources exhausted: Cannot spill GroupBy None Accumulators", + ) + .await +} + +#[tokio::test] +async fn group_by_row_hash() { + run_limit_test( + "select count(*) from t GROUP BY response_bytes", + "Resources exhausted: Cannot spill GroupBy Hash (Row) AggregationState", + ) + .await +} + +#[tokio::test] +async fn group_by_hash() { + run_limit_test( + // group by dict column + "select count(*) from t GROUP BY service, host, pod, container", + "Resources exhausted: Cannot spill GroupBy Hash Accumulators", + ) + .await +} + +/// 100K memory limit Review Comment: 100k? How does relate to 50 and 0.95? -- 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]
