MCPcopy Create free account
hub / github.com/apache/datafusion / format_error

Method format_error

datafusion/core/tests/sql/unparser.rs:265–289  ·  view source on GitHub ↗

Formats a detailed error message for the test case into a string.

(&self, name: &str)

Source from the content-addressed store, hash-verified

263
264 /// Formats a detailed error message for the test case into a string.
265 fn format_error(&self, name: &str) -> String {
266 match self {
267 TestCaseResult::Success => String::new(),
268 TestCaseResult::ResultsMismatch { original, unparsed } => {
269 format!(
270 "Results mismatch for {name}.\nOriginal SQL:\n{original}\n\nUnparsed SQL:\n{unparsed}"
271 )
272 }
273 TestCaseResult::UnparseError { original, error } => {
274 format!("Unparse error for {name}: {error}\nOriginal SQL:\n{original}")
275 }
276 TestCaseResult::ExecutionError { original, error } => {
277 format!("Execution error for {name}: {error}\nOriginal SQL:\n{original}")
278 }
279 TestCaseResult::UnparsedExecutionError {
280 original,
281 unparsed,
282 error,
283 } => {
284 format!(
285 "Unparsed execution error for {name}: {error}\nOriginal SQL:\n{original}\n\nUnparsed SQL:\n{unparsed}"
286 )
287 }
288 }
289 }
290}
291
292/// Executes a roundtrip test for a single SQL query.

Callers 1

run_roundtrip_testsFunction · 0.80

Calls 1

newFunction · 0.85

Tested by

no test coverage detected