001package gudusoft.gsqlparser.stmt.hive;
002
003import gudusoft.gsqlparser.EDbVendor;
004import gudusoft.gsqlparser.ESqlStatementType;
005import gudusoft.gsqlparser.TCustomSqlStatement;
006import gudusoft.gsqlparser.nodes.TObjectName;
007import gudusoft.gsqlparser.nodes.TParseTreeVisitor;
008import gudusoft.gsqlparser.nodes.TPartitionExtensionClause;
009import gudusoft.gsqlparser.nodes.hive.EHiveDescOption;
010import gudusoft.gsqlparser.nodes.hive.EHiveShowType;
011import gudusoft.gsqlparser.nodes.hive.THiveDescTablePartition;
012import gudusoft.gsqlparser.nodes.hive.THiveShowSqlNode;
013
014public class THiveShow extends TCustomSqlStatement {
015
016    private EHiveShowType showType;
017    private TObjectName showIdentifier;
018    private TObjectName dbName;
019    private TObjectName tableName;
020    private TObjectName functionName;
021    private TPartitionExtensionClause partitionSpec;
022    private TObjectName propertyName;
023    private boolean isExtended;
024    private THiveDescTablePartition tablePartition;
025    private EHiveDescOption showOptions;
026
027    public TObjectName getDbName() {
028        return dbName;
029    }
030
031    public TObjectName getFunctionName() {
032        return functionName;
033    }
034
035    public boolean isExtended() {
036        return isExtended;
037    }
038
039    public TPartitionExtensionClause getPartitionSpec() {
040        return partitionSpec;
041    }
042
043    public TObjectName getPropertyName() {
044        return propertyName;
045    }
046
047    public TObjectName getShowIdentifier() {
048        return showIdentifier;
049    }
050
051    public EHiveDescOption getShowOptions() {
052        return showOptions;
053    }
054
055    public EHiveShowType getShowType() {
056        return showType;
057    }
058
059    public TObjectName getTableName() {
060        return tableName;
061    }
062
063    public THiveDescTablePartition getTablePartition() {
064        return tablePartition;
065    }
066
067    public THiveShow(EDbVendor dbvendor) {
068        super(dbvendor);
069        sqlstatementtype = ESqlStatementType.ssthiveShow;
070    }
071
072    public int doParseStatement(TCustomSqlStatement psql) {
073        if (rootNode == null) return -1;
074        super.doParseStatement(psql);
075        THiveShowSqlNode node = (THiveShowSqlNode)rootNode;
076
077        this.dbName = node.getDbName();
078        this.partitionSpec  = node.getPartitionSpec();
079        this.isExtended = node.isExtended();
080        this.showType = node.getShowType();
081        this.showOptions = node.getShowOptions();
082        this.tableName = node.getTableName();
083        this.tablePartition = node.getTablePartition();
084        this.showIdentifier = node.getShowIdentifier();
085        this.propertyName = node.getPropertyName();
086        this.functionName = node.getFunctionName();
087
088
089        return 0;
090    }
091
092    public void accept(TParseTreeVisitor v){
093        v.preVisit(this);
094        v.postVisit(this);
095    }
096
097    public void acceptChildren(TParseTreeVisitor v){
098        v.preVisit(this);
099        v.postVisit(this);
100    }
101
102    public void setShowType(EHiveShowType showType) {
103        this.showType = showType;
104    }
105
106    public void setShowIdentifier(TObjectName showIdentifier) {
107        this.showIdentifier = showIdentifier;
108    }
109
110    public void setDbName(TObjectName dbName) {
111        this.dbName = dbName;
112    }
113
114    public void setTableName(TObjectName tableName) {
115        this.tableName = tableName;
116    }
117
118    public void setFunctionName(TObjectName functionName) {
119        this.functionName = functionName;
120    }
121
122    public void setPartitionSpec(TPartitionExtensionClause partitionSpec) {
123        this.partitionSpec = partitionSpec;
124    }
125
126    public void setPropertyName(TObjectName propertyName) {
127        this.propertyName = propertyName;
128    }
129
130    public void setExtended(boolean isExtended) {
131        this.isExtended = isExtended;
132    }
133
134    public void setTablePartition(THiveDescTablePartition tablePartition) {
135        this.tablePartition = tablePartition;
136    }
137
138    public void setShowOptions(EHiveDescOption showOptions) {
139        this.showOptions = showOptions;
140    }
141}