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

Function test_syntax_error

datafusion/sql/tests/cases/diagnostic.rs:373–392  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

371
372#[test]
373fn test_syntax_error() -> Result<()> {
374 // create a table with a column of type varchar
375 let query = "CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV PARTITIONED BY (c1, p1 /*int*/int/*int*/) LOCATION 'foo.csv'";
376 let spans = get_spans(query);
377 match DFParser::parse_sql(query) {
378 Ok(_) => panic!("expected error"),
379 Err(err) => match err.diagnostic() {
380 Some(diag) => {
381 let diag = diag.clone();
382 assert_snapshot!(diag.message, @"Expected: ',' or ')' after partition definition, found: int at Line: 1, Column: 77");
383 println!("{spans:?}");
384 assert_eq!(diag.span, Some(spans["int"]));
385 Ok(())
386 }
387 None => {
388 panic!("expected diagnostic")
389 }
390 },
391 }
392}

Callers

nothing calls this directly

Calls 3

get_spansFunction · 0.85
diagnosticMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…