001package gudusoft.gsqlparser.nodes;
002/*
003 * Date: 13-8-9
004 */
005
006import gudusoft.gsqlparser.EAlterIndexOption;
007import gudusoft.gsqlparser.EDbObjectType;
008import gudusoft.gsqlparser.nodes.hive.THiveKeyValueProperty;
009
010public class TAlterIndexSqlNode extends TParseTreeNode {
011
012    private TObjectName indexName;
013    private TObjectName onIndexName;
014    private EAlterIndexOption alterIndexOption;
015    private TPTNodeList <THiveKeyValueProperty> indexProperties;
016    private TPartitionExtensionClause partitionSpec;
017    private TObjectName tablespaceName;
018    private TObjectName partitionName;
019    private TObjectName newIndexName;
020
021    public TObjectName getTablespaceName() {
022        return tablespaceName;
023    }
024
025    public TObjectName getPartitionName() {
026        return partitionName;
027    }
028
029    public TObjectName getNewIndexName() {
030        return newIndexName;
031    }
032
033    public TObjectName getOnIndexName() {
034        return onIndexName;
035    }
036
037    public EAlterIndexOption getAlterIndexOption() {
038        return alterIndexOption;
039    }
040
041    public TPTNodeList<THiveKeyValueProperty> getIndexProperties() {
042        return indexProperties;
043    }
044
045    public TPartitionExtensionClause getPartitionSpec() {
046        return partitionSpec;
047    }
048
049    public TObjectName getIndexName() {
050        return indexName;
051    }
052
053    public void init(Object arg1){
054        if (arg1 instanceof EAlterIndexOption){
055            alterIndexOption = (EAlterIndexOption)arg1;
056        }else if (arg1 instanceof TObjectName){
057            indexName = (TObjectName)arg1;
058        }
059    }
060
061    public void init(Object arg1,Object arg2){
062        alterIndexOption = (EAlterIndexOption)arg1;
063        indexName = (TObjectName)arg2;
064        indexName.setDbObjectTypeDirectly(EDbObjectType.index);
065    }
066
067    public void init(Object arg1,Object arg2,Object arg3){
068        init(arg1,arg2);
069        switch (alterIndexOption){
070            case setTablespace:
071                tablespaceName = (TObjectName)arg3;
072                break;
073            case attachPartition:
074                partitionName = (TObjectName)arg3;
075                break;
076            case rename:
077                newIndexName = (TObjectName)arg3;
078                newIndexName.setDbObjectTypeDirectly(EDbObjectType.index);
079                break;
080            default:
081                onIndexName = (TObjectName)arg3;
082                break;
083        }
084    }
085
086    public void init(Object arg1,Object arg2,Object arg3,Object arg4){
087        init(arg1,arg2,arg3);
088        switch (alterIndexOption){
089            case setProperties:
090                indexProperties = (TPTNodeList)arg4;
091                break;
092            case rebuild:
093                partitionSpec = (TPartitionExtensionClause)arg4;
094                break;
095        }
096    }
097
098    public void init(Object arg1,Object arg2,Object arg3,Object arg4,Object arg5){
099        init(arg1,arg2,arg3,arg4);
100        partitionSpec = (TPartitionExtensionClause)arg5;
101
102    }
103
104    public void setIndexName(TObjectName indexName) {
105        this.indexName = indexName;
106    }
107
108    public void setOnIndexName(TObjectName onIndexName) {
109        this.onIndexName = onIndexName;
110    }
111
112    public void setAlterIndexOption(EAlterIndexOption alterIndexOption) {
113        this.alterIndexOption = alterIndexOption;
114    }
115
116    public void setIndexProperties(TPTNodeList<THiveKeyValueProperty> indexProperties) {
117        this.indexProperties = indexProperties;
118    }
119
120    public void setPartitionSpec(TPartitionExtensionClause partitionSpec) {
121        this.partitionSpec = partitionSpec;
122    }
123}