From f7c2eeecf3e435e3a8bf07e4a656dcfc07e4150c Mon Sep 17 00:00:00 2001 From: Eric Fu Date: Thu, 2 Jan 2025 12:54:50 +0800 Subject: [PATCH 1/2] add back parser support of label Signed-off-by: Eric Fu --- sqllogictest/src/parser.rs | 32 ++++++++++++++++++++++++++++---- sqllogictest/src/runner.rs | 4 +++- tests/retry/query_retry.slt | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/sqllogictest/src/parser.rs b/sqllogictest/src/parser.rs index b069469..2426a0a 100644 --- a/sqllogictest/src/parser.rs +++ b/sqllogictest/src/parser.rs @@ -95,6 +95,7 @@ pub enum QueryExpect { types: Vec, sort_mode: Option, result_mode: Option, + label: Option, results: Vec, }, /// Query should fail with the given error message. @@ -108,6 +109,7 @@ impl QueryExpect { types: Vec::new(), sort_mode: None, result_mode: None, + label: None, results: Vec::new(), } } @@ -255,12 +257,18 @@ impl std::fmt::Display for Record { write!(f, "query ")?; match expected { QueryExpect::Results { - types, sort_mode, .. + types, + sort_mode, + label, + .. } => { write!(f, "{}", types.iter().map(|c| c.to_char()).join(""))?; if let Some(sort_mode) = sort_mode { write!(f, " {}", sort_mode.as_str())?; } + if let Some(label) = label { + write!(f, " {label}")?; + } } QueryExpect::Error(err) => err.fmt_inline(f)?, } @@ -281,6 +289,8 @@ impl std::fmt::Display for Record { for result in results { write!(f, "\n{result}")?; } + + // query always ends with a blank line writeln!(f)? } QueryExpect::Error(err) => err.fmt_multiline(f)?, @@ -815,6 +825,7 @@ fn parse_inner(loc: &Location, script: &str) -> Result { + // query [] [