Skip to content

Commit

Permalink
test: Add test for no functions registered error
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun-H committed Sep 15, 2024
1 parent fb487d4 commit d372501
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions datafusion/sql/tests/sql_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4436,3 +4436,23 @@ fn init() {
// Enable RUST_LOG logging configuration for tests
let _ = env_logger::try_init();
}

#[test]
fn test_no_functions_registered() {
let sql = "SELECT foo()";

let options = ParserOptions::default();
let dialect = &GenericDialect {};
let state = MockSessionState::default();
let context = MockContextProvider { state };
let planner = SqlToRel::new_with_options(&context, options);
let result = DFParser::parse_sql_with_dialect(sql, dialect);
let mut ast = result.unwrap();

let err = planner.statement_to_plan(ast.pop_front().unwrap());

assert_contains!(
err.unwrap_err().to_string(),
"Internal error: No functions registered with this context."
);
}

0 comments on commit d372501

Please sign in to comment.