001package gudusoft.gsqlparser.stmt.hive;
002
003
004import gudusoft.gsqlparser.EDbVendor;
005import gudusoft.gsqlparser.ESqlStatementType;
006import gudusoft.gsqlparser.TCustomSqlStatement;
007import gudusoft.gsqlparser.nodes.TCreateFunctionSqlNode;
008import gudusoft.gsqlparser.nodes.TObjectName;
009import gudusoft.gsqlparser.nodes.TParseTreeVisitor;
010
011/**
012 * Hive create function.
013 *
014 */
015public class THiveCreateFunction extends TCustomSqlStatement {
016
017    private TObjectName functionName = null;
018    private TObjectName asName;
019
020
021    public THiveCreateFunction(EDbVendor dbvendor) {
022        super(dbvendor);
023        sqlstatementtype = ESqlStatementType.ssthiveCreateFunction;
024    }
025
026    public TObjectName getAsName() {
027        return asName;
028    }
029
030    public TObjectName getFunctionName() {
031        return functionName;
032    }
033
034    public int doParseStatement(TCustomSqlStatement psql) {
035        if (rootNode == null) return -1;
036        super.doParseStatement(psql);
037        TCreateFunctionSqlNode node = (TCreateFunctionSqlNode)rootNode;
038        this.functionName = node.getFunctionName();
039        this.asName = node.getAsName();
040
041
042        return 0;
043    }
044
045    public void accept(TParseTreeVisitor v){
046        v.preVisit(this);
047        v.postVisit(this);
048    }
049
050    public void acceptChildren(TParseTreeVisitor v){
051        v.preVisit(this);
052        v.postVisit(this);
053    }
054
055    public void setFunctionName(TObjectName functionName) {
056        this.functionName = functionName;
057    }
058
059    public void setAsName(TObjectName asName) {
060        this.asName = asName;
061    }
062}