Enhance object name path segments (#1539)

This commit is contained in:
Ayman Elkfrawy 2025-01-26 06:13:51 -08:00 committed by GitHub
parent fd6c98e933
commit 211b15e790
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 584 additions and 466 deletions

View file

@ -368,7 +368,7 @@ fn set_statement_with_minus() {
Statement::SetVariable {
local: false,
hivevar: false,
variables: OneOrManyWithParens::One(ObjectName(vec![
variables: OneOrManyWithParens::One(ObjectName::from(vec![
Ident::new("hive"),
Ident::new("tez"),
Ident::new("java"),
@ -461,7 +461,10 @@ fn parse_delimited_identifiers() {
json_path: _,
sample: _,
} => {
assert_eq!(vec![Ident::with_quote('"', "a table")], name.0);
assert_eq!(
ObjectName::from(vec![Ident::with_quote('"', "a table")]),
name
);
assert_eq!(Ident::with_quote('"', "alias"), alias.unwrap().name);
assert!(args.is_none());
assert!(with_hints.is_empty());
@ -480,7 +483,7 @@ fn parse_delimited_identifiers() {
);
assert_eq!(
&Expr::Function(Function {
name: ObjectName(vec![Ident::with_quote('"', "myfun")]),
name: ObjectName::from(vec![Ident::with_quote('"', "myfun")]),
uses_odbc_syntax: false,
parameters: FunctionArguments::None,
args: FunctionArguments::List(FunctionArgumentList {
@ -516,7 +519,7 @@ fn parse_use() {
// Test single identifier without quotes
assert_eq!(
hive().verified_stmt(&format!("USE {}", object_name)),
Statement::Use(Use::Object(ObjectName(vec![Ident::new(
Statement::Use(Use::Object(ObjectName::from(vec![Ident::new(
object_name.to_string()
)])))
);
@ -524,7 +527,7 @@ fn parse_use() {
// Test single identifier with different type of quotes
assert_eq!(
hive().verified_stmt(&format!("USE {}{}{}", quote, object_name, quote)),
Statement::Use(Use::Object(ObjectName(vec![Ident::with_quote(
Statement::Use(Use::Object(ObjectName::from(vec![Ident::with_quote(
quote,
object_name.to_string(),
)])))