@@ -32,7 +32,7 @@ use sqlparser::ast::Value::Boolean;
3232use sqlparser:: ast:: * ;
3333use sqlparser:: dialect:: ClickHouseDialect ;
3434use sqlparser:: dialect:: GenericDialect ;
35- use sqlparser:: parser:: ParserError :: ParserError ;
35+ use sqlparser:: parser:: ParserError ;
3636
3737#[ test]
3838fn parse_map_access_expr ( ) {
@@ -289,13 +289,19 @@ fn parse_alter_table_attach_and_detach_partition() {
289289 clickhouse_and_generic( )
290290 . parse_sql_statements( format!( "ALTER TABLE t0 {operation} PARTITION" ) . as_str( ) )
291291 . unwrap_err( ) ,
292- ParserError ( "Expected: an expression, found: EOF" . to_string( ) )
292+ ParserError :: SpannedParserError (
293+ "Expected: an expression, found: EOF" . to_string( ) ,
294+ Span :: empty( )
295+ )
293296 ) ;
294297 assert_eq ! (
295298 clickhouse_and_generic( )
296299 . parse_sql_statements( format!( "ALTER TABLE t0 {operation} PART" ) . as_str( ) )
297300 . unwrap_err( ) ,
298- ParserError ( "Expected: an expression, found: EOF" . to_string( ) )
301+ ParserError :: SpannedParserError (
302+ "Expected: an expression, found: EOF" . to_string( ) ,
303+ Span :: empty( )
304+ )
299305 ) ;
300306 }
301307}
@@ -358,19 +364,22 @@ fn parse_alter_table_add_projection() {
358364 clickhouse_and_generic( )
359365 . parse_sql_statements( "ALTER TABLE t0 ADD PROJECTION my_name" )
360366 . unwrap_err( ) ,
361- ParserError ( "Expected: (, found: EOF" . to_string( ) )
367+ ParserError :: SpannedParserError ( "Expected: (, found: EOF" . to_string( ) , Span :: empty ( ) )
362368 ) ;
363369 assert_eq ! (
364370 clickhouse_and_generic( )
365371 . parse_sql_statements( "ALTER TABLE t0 ADD PROJECTION my_name ()" )
366372 . unwrap_err( ) ,
367- ParserError ( "Expected: SELECT, found: )" . to_string( ) )
373+ ParserError :: SpannedParserError ( "Expected: SELECT, found: )" . to_string( ) , Span :: empty ( ) )
368374 ) ;
369375 assert_eq ! (
370376 clickhouse_and_generic( )
371377 . parse_sql_statements( "ALTER TABLE t0 ADD PROJECTION my_name (SELECT)" )
372378 . unwrap_err( ) ,
373- ParserError ( "Expected: an expression, found: )" . to_string( ) )
379+ ParserError :: SpannedParserError (
380+ "Expected: an expression, found: )" . to_string( ) ,
381+ Span :: empty( )
382+ )
374383 ) ;
375384}
376385
@@ -400,7 +409,10 @@ fn parse_alter_table_drop_projection() {
400409 clickhouse_and_generic( )
401410 . parse_sql_statements( "ALTER TABLE t0 DROP PROJECTION" )
402411 . unwrap_err( ) ,
403- ParserError ( "Expected: identifier, found: EOF" . to_string( ) )
412+ ParserError :: SpannedParserError (
413+ "Expected: identifier, found: EOF" . to_string( ) ,
414+ Span :: empty( )
415+ )
404416 ) ;
405417}
406418
@@ -447,7 +459,10 @@ fn parse_alter_table_clear_and_materialize_projection() {
447459 clickhouse_and_generic( )
448460 . parse_sql_statements( format!( "ALTER TABLE t0 {keyword} PROJECTION" , ) . as_str( ) )
449461 . unwrap_err( ) ,
450- ParserError ( "Expected: identifier, found: EOF" . to_string( ) )
462+ ParserError :: SpannedParserError (
463+ "Expected: identifier, found: EOF" . to_string( ) ,
464+ Span :: empty( )
465+ )
451466 ) ;
452467
453468 assert_eq ! (
@@ -456,7 +471,10 @@ fn parse_alter_table_clear_and_materialize_projection() {
456471 format!( "ALTER TABLE t0 {keyword} PROJECTION my_name IN PARTITION" , ) . as_str( )
457472 )
458473 . unwrap_err( ) ,
459- ParserError ( "Expected: identifier, found: EOF" . to_string( ) )
474+ ParserError :: SpannedParserError (
475+ "Expected: identifier, found: EOF" . to_string( ) ,
476+ Span :: empty( )
477+ )
460478 ) ;
461479
462480 assert_eq ! (
@@ -465,7 +483,10 @@ fn parse_alter_table_clear_and_materialize_projection() {
465483 format!( "ALTER TABLE t0 {keyword} PROJECTION my_name IN" , ) . as_str( )
466484 )
467485 . unwrap_err( ) ,
468- ParserError ( "Expected: end of statement, found: IN" . to_string( ) )
486+ ParserError :: SpannedParserError (
487+ "Expected: end of statement, found: IN" . to_string( ) ,
488+ Span :: empty( )
489+ )
469490 ) ;
470491 }
471492}
@@ -513,19 +534,28 @@ fn parse_optimize_table() {
513534 clickhouse_and_generic( )
514535 . parse_sql_statements( "OPTIMIZE TABLE t0 DEDUPLICATE BY" )
515536 . unwrap_err( ) ,
516- ParserError ( "Expected: an expression, found: EOF" . to_string( ) )
537+ ParserError :: SpannedParserError (
538+ "Expected: an expression, found: EOF" . to_string( ) ,
539+ Span :: empty( )
540+ )
517541 ) ;
518542 assert_eq ! (
519543 clickhouse_and_generic( )
520544 . parse_sql_statements( "OPTIMIZE TABLE t0 PARTITION" )
521545 . unwrap_err( ) ,
522- ParserError ( "Expected: an expression, found: EOF" . to_string( ) )
546+ ParserError :: SpannedParserError (
547+ "Expected: an expression, found: EOF" . to_string( ) ,
548+ Span :: empty( )
549+ )
523550 ) ;
524551 assert_eq ! (
525552 clickhouse_and_generic( )
526553 . parse_sql_statements( "OPTIMIZE TABLE t0 PARTITION ID" )
527554 . unwrap_err( ) ,
528- ParserError ( "Expected: identifier, found: EOF" . to_string( ) )
555+ ParserError :: SpannedParserError (
556+ "Expected: identifier, found: EOF" . to_string( ) ,
557+ Span :: empty( )
558+ )
529559 ) ;
530560}
531561
@@ -1063,7 +1093,7 @@ fn parse_settings_in_query() {
10631093 clickhouse_and_generic( )
10641094 . parse_sql_statements( sql)
10651095 . unwrap_err( ) ,
1066- ParserError ( error_msg. to_string( ) )
1096+ ParserError :: SpannedParserError ( error_msg. to_string( ) , Span :: empty ( ) )
10671097 ) ;
10681098 }
10691099}
@@ -1568,23 +1598,32 @@ fn parse_freeze_and_unfreeze_partition() {
15681598 clickhouse_and_generic( )
15691599 . parse_sql_statements( format!( "ALTER TABLE t0 {operation_name} PARTITION" ) . as_str( ) )
15701600 . unwrap_err( ) ,
1571- ParserError ( "Expected: an expression, found: EOF" . to_string( ) )
1601+ ParserError :: SpannedParserError (
1602+ "Expected: an expression, found: EOF" . to_string( ) ,
1603+ Span :: empty( )
1604+ )
15721605 ) ;
15731606 assert_eq ! (
15741607 clickhouse_and_generic( )
15751608 . parse_sql_statements(
15761609 format!( "ALTER TABLE t0 {operation_name} PARTITION p0 WITH" ) . as_str( )
15771610 )
15781611 . unwrap_err( ) ,
1579- ParserError ( "Expected: NAME, found: EOF" . to_string( ) )
1612+ ParserError :: SpannedParserError (
1613+ "Expected: NAME, found: EOF" . to_string( ) ,
1614+ Span :: empty( )
1615+ )
15801616 ) ;
15811617 assert_eq ! (
15821618 clickhouse_and_generic( )
15831619 . parse_sql_statements(
15841620 format!( "ALTER TABLE t0 {operation_name} PARTITION p0 WITH NAME" ) . as_str( )
15851621 )
15861622 . unwrap_err( ) ,
1587- ParserError ( "Expected: identifier, found: EOF" . to_string( ) )
1623+ ParserError :: SpannedParserError (
1624+ "Expected: identifier, found: EOF" . to_string( ) ,
1625+ Span :: empty( )
1626+ )
15881627 ) ;
15891628 }
15901629}
0 commit comments