alamb commented on code in PR #17021: URL: https://github.com/apache/datafusion/pull/17021#discussion_r2294374390
########## datafusion-cli/tests/cli_integration.rs: ########## @@ -352,10 +401,34 @@ fn test_backtrace_output(#[case] query: &str) { let stderr = String::from_utf8_lossy(&output.stderr); let combined_output = format!("{}{}", stdout, stderr); - // Assert that the output includes literal 'backtrace' + // Accept either a printed backtrace or a readable error message. + // Some builds may not include backtrace support in the binary; in that + // case the CLI prints a clear planning error message instead. Verify one + // of these is present to avoid a fragile test. + let has_backtrace = combined_output.to_lowercase().contains("backtrace"); + let lower_stdout = stdout.to_lowercase(); + let lower_stderr = stderr.to_lowercase(); + + let has_planning_error = lower_stdout.contains("failed to coerce arguments") Review Comment: I don't understand any of these changes -- why would we accept arrow cast errors? ########## datafusion/execution/src/memory_pool/metrics.rs: ########## @@ -0,0 +1,90 @@ +// 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. + +//! Memory usage metrics for query execution. + +use super::{human_readable_size, ConsumerMemoryMetrics}; +use std::{collections::BTreeMap, fmt::Write}; +/// Format summary of memory usage metrics. +/// +/// Returns a string with peak usage, cumulative allocations, and totals per +/// operator category. The caller is responsible for printing the returned +/// string if desired. +pub fn format_metrics(metrics: &[ConsumerMemoryMetrics]) -> String { Review Comment: I think this formatting stuff should be put in the CLI code for now (not the main repo) ########## datafusion-cli/src/cli_context.rs: ########## @@ -52,6 +52,19 @@ pub trait CliSessionContext { &self, plan: LogicalPlan, ) -> Result<DataFrame, DataFusionError>; + + /// Return true if memory profiling is enabled. + fn memory_profiling(&self) -> bool { Review Comment: I think the memory profiling flag would best be stored on `PrintOptions`, similarly to the `quiet` mode flag (that suppresses execution time printing). Then you would not need to introduce so much new code and a new trait https://github.com/apache/datafusion/blob/df45d186d34f2ac131d64e4a068d9f39b35e99c7/datafusion-cli/src/print_options.rs#L73-L72 ########## datafusion-cli/tests/snapshots/aws_options.snap: ########## @@ -1,9 +1,9 @@ --- -source: tests/cli_integration.rs +source: datafusion-cli/tests/cli_integration.rs Review Comment: Why did you change these files? -- 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