|
22 | 22 |
|
23 | 23 | use sqlparser::ast::{ |
24 | 24 | ClusteredBy, CommentDef, CreateFunction, CreateFunctionBody, CreateFunctionUsing, CreateTable, |
25 | | - Expr, Function, FunctionArgumentList, FunctionArguments, Ident, ObjectName, OrderByExpr, |
26 | | - OrderByOptions, OrderBySort, SelectItem, Set, Statement, TableFactor, UnaryOperator, Use, |
27 | | - Value, |
| 25 | + Expr, Ident, ObjectName, OrderByExpr, OrderByOptions, OrderBySort, Set, Statement, |
| 26 | + UnaryOperator, Use, Value, |
28 | 27 | }; |
29 | 28 | use sqlparser::dialect::{AnsiDialect, GenericDialect, HiveDialect}; |
30 | 29 | use sqlparser::parser::ParserError; |
@@ -461,69 +460,6 @@ fn filter_as_alias() { |
461 | 460 |
|
462 | 461 | #[test] |
463 | 462 | fn parse_delimited_identifiers() { |
464 | | - // check that quoted identifiers in any position remain quoted after serialization |
465 | | - let select = hive().verified_only_select( |
466 | | - r#"SELECT "alias"."bar baz", "myfun"(), "simple id" AS "column alias" FROM "a table" AS "alias""#, |
467 | | - ); |
468 | | - // check FROM |
469 | | - match only(select.from).relation { |
470 | | - TableFactor::Table { |
471 | | - name, |
472 | | - alias, |
473 | | - args, |
474 | | - with_hints, |
475 | | - version, |
476 | | - with_ordinality: _, |
477 | | - partitions: _, |
478 | | - json_path: _, |
479 | | - sample: _, |
480 | | - index_directives: _, |
481 | | - } => { |
482 | | - assert_eq!( |
483 | | - ObjectName::from(vec![Ident::with_quote('"', "a table")]), |
484 | | - name |
485 | | - ); |
486 | | - assert_eq!(Ident::with_quote('"', "alias"), alias.unwrap().name); |
487 | | - assert!(args.is_none()); |
488 | | - assert!(with_hints.is_empty()); |
489 | | - assert!(version.is_none()); |
490 | | - } |
491 | | - _ => panic!("Expecting TableFactor::Table"), |
492 | | - } |
493 | | - // check SELECT |
494 | | - assert_eq!(3, select.projection.len()); |
495 | | - assert_eq!( |
496 | | - &Expr::CompoundIdentifier(vec![ |
497 | | - Ident::with_quote('"', "alias"), |
498 | | - Ident::with_quote('"', "bar baz"), |
499 | | - ]), |
500 | | - expr_from_projection(&select.projection[0]), |
501 | | - ); |
502 | | - assert_eq!( |
503 | | - &Expr::Function(Function { |
504 | | - name: ObjectName::from(vec![Ident::with_quote('"', "myfun")]), |
505 | | - uses_odbc_syntax: false, |
506 | | - parameters: FunctionArguments::None, |
507 | | - args: FunctionArguments::List(FunctionArgumentList { |
508 | | - duplicate_treatment: None, |
509 | | - args: vec![], |
510 | | - clauses: vec![], |
511 | | - }), |
512 | | - null_treatment: None, |
513 | | - filter: None, |
514 | | - over: None, |
515 | | - within_group: vec![], |
516 | | - }), |
517 | | - expr_from_projection(&select.projection[1]), |
518 | | - ); |
519 | | - match &select.projection[2] { |
520 | | - SelectItem::ExprWithAlias { expr, alias } => { |
521 | | - assert_eq!(&Expr::Identifier(Ident::with_quote('"', "simple id")), expr); |
522 | | - assert_eq!(&Ident::with_quote('"', "column alias"), alias); |
523 | | - } |
524 | | - _ => panic!("Expected: ExprWithAlias"), |
525 | | - } |
526 | | - |
527 | 463 | hive().verified_stmt(r#"CREATE TABLE "foo" ("bar" "int")"#); |
528 | 464 | hive().verified_stmt(r#"ALTER TABLE foo ADD CONSTRAINT "bar" PRIMARY KEY (baz)"#); |
529 | 465 | //TODO verified_stmt(r#"UPDATE foo SET "bar" = 5"#); |
|
0 commit comments