use of io.crate.sql.tree.CreateFunction in project crate by crate.
the class AstBuilder method visitCreateFunction.
@Override
public Node visitCreateFunction(SqlBaseParser.CreateFunctionContext context) {
QualifiedName functionName = getQualifiedName(context.name);
validateFunctionName(functionName);
return new CreateFunction(functionName, context.REPLACE() != null, visitCollection(context.functionArgument(), FunctionArgument.class), (ColumnType) visit(context.returnType), (Expression) visit(context.language), (Expression) visit(context.body));
}
use of io.crate.sql.tree.CreateFunction in project crate by crate.
the class TestStatementBuilder method printStatement.
private static void printStatement(String sql) {
println(sql.trim());
println("");
Statement statement = SqlParser.createStatement(sql);
println(statement.toString());
println("");
// TODO: support formatting all statement types
if (statement instanceof Query || statement instanceof CreateTable || statement instanceof CopyFrom || statement instanceof SwapTable || statement instanceof GCDanglingArtifacts || statement instanceof CreateFunction || statement instanceof CreateUser || statement instanceof GrantPrivilege || statement instanceof DenyPrivilege || statement instanceof RevokePrivilege || statement instanceof DropUser || statement instanceof DropAnalyzer || statement instanceof DropFunction || statement instanceof DropTable || statement instanceof DropBlobTable || statement instanceof DropView || statement instanceof DropRepository || statement instanceof DropSnapshot || statement instanceof Update || statement instanceof Insert || statement instanceof SetSessionAuthorizationStatement || statement instanceof Window) {
println(SqlFormatter.formatSql(statement));
println("");
assertFormattedSql(statement);
}
println("=".repeat(60));
println("");
}
Aggregations