Encapsulate CreateFunction (#1573)

This commit is contained in:
Philip Cristiano 2024-12-02 12:45:14 -05:00 committed by GitHub
parent bd750dfada
commit e16b24679a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 149 additions and 148 deletions

View file

@ -21,9 +21,10 @@
//! is also tested (on the inputs it can handle).
use sqlparser::ast::{
ClusteredBy, CommentDef, CreateFunctionBody, CreateFunctionUsing, CreateTable, Expr, Function,
FunctionArgumentList, FunctionArguments, Ident, ObjectName, OneOrManyWithParens, OrderByExpr,
SelectItem, Statement, TableFactor, UnaryOperator, Use, Value,
ClusteredBy, CommentDef, CreateFunction, CreateFunctionBody, CreateFunctionUsing, CreateTable,
Expr, Function, FunctionArgumentList, FunctionArguments, Ident, ObjectName,
OneOrManyWithParens, OrderByExpr, SelectItem, Statement, TableFactor, UnaryOperator, Use,
Value,
};
use sqlparser::dialect::{GenericDialect, HiveDialect, MsSqlDialect};
use sqlparser::parser::ParserError;
@ -392,13 +393,13 @@ fn set_statement_with_minus() {
fn parse_create_function() {
let sql = "CREATE TEMPORARY FUNCTION mydb.myfunc AS 'org.random.class.Name' USING JAR 'hdfs://somewhere.com:8020/very/far'";
match hive().verified_stmt(sql) {
Statement::CreateFunction {
Statement::CreateFunction(CreateFunction {
temporary,
name,
function_body,
using,
..
} => {
}) => {
assert!(temporary);
assert_eq!(name.to_string(), "mydb.myfunc");
assert_eq!(