2010YOUY01 commented on code in PR #15594:
URL: https://github.com/apache/datafusion/pull/15594#discussion_r2032386011


##########
datafusion/core/tests/sql/runtime_config.rs:
##########
@@ -0,0 +1,73 @@
+// 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.
+
+//! Tests for runtime configuration SQL interface
+
+use datafusion::prelude::*;
+use datafusion_common::Result;
+
+#[tokio::test]
+async fn test_set_memory_limit() -> Result<()> {
+    let ctx = SessionContext::new();
+
+    // Set memory limit to 100MB using SQL - note the quotes around the value
+    ctx.sql("SET datafusion.runtime.memory_limit = '100M'")

Review Comment:
   Running this test can't ensure this config is set, because it can run 
without setting the memory limit and use the default `UnboundedMemoryPool`, 
instead I think it should assert the spill count for a query that has spilled 
some intermediate data.
   ```
   SET datafusion.runtime.memory_limit = '1M'
   set datafusion.execution.sort_spill_reservation_bytes = 0;
   
   select * from generate_series(1, 100000) as t1(v1) order by v1;
   -- And assert spill-count from the query is > 0
   ```
   You can check this 
https://github.com/apache/datafusion/blob/4ae0edea8eb7d5ad5df07e22a8fb39aa9fd1e2df/datafusion/core/tests/memory_limit/mod.rs#L525
 for how to assert the spill file count.
   
   Later after all configurations are added, I think we should make this test 
case stronger by setting more runtime configs, and do some property test to 
ensure all of them are properly set.
   
   BTW, I tried the above test locally, and the `generate_series` UDTF seems 
not registered in the PR branch, but it works in the main branch.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to