001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.EDbObjectType;
004import gudusoft.gsqlparser.EIndexType;
005import gudusoft.gsqlparser.TBaseType;
006import gudusoft.gsqlparser.TSourceToken;
007import gudusoft.gsqlparser.nodes.couchbase.TIndexKeyTerm;
008import gudusoft.gsqlparser.nodes.couchbase.TKeyspaceRef;
009import gudusoft.gsqlparser.nodes.hive.THiveIndexProperties;
010import gudusoft.gsqlparser.nodes.hive.THiveRowFormat;
011import gudusoft.gsqlparser.nodes.hive.THiveTableFileFormat;
012import gudusoft.gsqlparser.nodes.hive.THiveTableProperties;
013
014public class TCreateIndexSqlNode extends TParseTreeNode {
015
016    private TWhereClause whereCondition;
017
018    public void setWhereCondition(TWhereClause whereCondition) {
019        this.whereCondition = whereCondition;
020    }
021
022    public TWhereClause getWhereCondition() {
023        return whereCondition;
024    }
025
026    private TFromTableList bitmapJoinFromTableList;
027
028    public void setBitmapJoinFromTableList(TFromTableList bitmapJoinFromTableList) {
029        this.bitmapJoinFromTableList = bitmapJoinFromTableList;
030    }
031
032    public TFromTableList getBitmapJoinFromTableList() {
033        return bitmapJoinFromTableList;
034    }
035
036    private TDummyList optionList;
037
038    public void setOptionList(TDummyList optionList) {
039        this.optionList = optionList;
040    }
041
042    public TDummyList getOptionList() {
043
044        return optionList;
045    }
046
047    public void setFilterPredicate(TExpression filterPredicate) {
048        this.filterPredicate = filterPredicate;
049    }
050
051    public TExpression getFilterPredicate() {
052
053        return filterPredicate;
054    }
055
056    private TExpression filterPredicate;
057    private TAliasClause tableAlias;
058
059    public TAliasClause getTableAlias() {
060        return tableAlias;
061    }
062
063    public void setTableAlias(TAliasClause tableAlias) {
064        this.tableAlias = tableAlias;
065    }
066
067    private TObjectName indexName = null;
068    private EIndexType indexType = EIndexType.itNormal;
069    private TObjectName tableName = null;
070    private TOrderByItemList columnNameList = null;
071    private TObjectName asTypeName; //hive
072    private boolean deferredRebuildIndex;
073    private THiveIndexProperties indexProperties;
074    private TObjectName inTableName;
075    private THiveRowFormat tableRowFormat;
076
077    public void setIndexType(EIndexType indexType) {
078        this.indexType = indexType;
079    }
080
081    private THiveTableFileFormat tableFileFormat;
082    private TObjectName tableLocation;
083    private THiveTableProperties tableProperties;
084    private TObjectName indexComment;
085    private boolean unique = false;
086    private boolean isClustered = false;
087    private boolean isNonClustered = false;
088    private boolean ifNotExists = false;
089
090    public boolean isIfNotExists() {
091        return ifNotExists;
092    }
093
094    public void setIfNotExists(boolean ifNotExists) {
095        this.ifNotExists = ifNotExists;
096    }
097
098    public boolean isClustered() {
099        return isClustered;
100    }
101
102    public boolean isNonClustered() {
103        return isNonClustered;
104    }
105
106    public void setClusteredToken(TSourceToken st){
107        if (st == null) return;
108        if (st.toString().equalsIgnoreCase("clustered")){
109            isClustered = true;
110        }else if (st.toString().equalsIgnoreCase("nonclustered")){
111            isNonClustered = true;
112        }
113    }
114
115    public void setIndexComment(TObjectName indexComment) {
116        this.indexComment = indexComment;
117    }
118
119    public TObjectName getIndexComment() {
120
121        return indexComment;
122    }
123
124    public void setTableProperties(THiveTableProperties tableProperties) {
125        this.tableProperties = tableProperties;
126    }
127
128    public THiveTableProperties getTableProperties() {
129
130        return tableProperties;
131    }
132
133    public void setTableLocation(TObjectName tableLocation) {
134        this.tableLocation = tableLocation;
135    }
136
137    public TObjectName getTableLocation() {
138
139        return tableLocation;
140    }
141
142    public void setTableFileFormat(THiveTableFileFormat tableFileFormat) {
143        this.tableFileFormat = tableFileFormat;
144    }
145
146    public THiveTableFileFormat getTableFileFormat() {
147
148        return tableFileFormat;
149    }
150
151    public void setTableRowFormat(THiveRowFormat tableRowFormat) {
152        this.tableRowFormat = tableRowFormat;
153    }
154
155    public THiveRowFormat getTableRowFormat() {
156
157        return tableRowFormat;
158    }
159
160    public void setInTableName(TObjectName inTableName) {
161        this.inTableName = inTableName;
162    }
163
164    public TObjectName getInTableName() {
165
166        return inTableName;
167    }
168
169    public void setDeferredRebuildIndex(boolean deferredRebuildIndex) {
170        this.deferredRebuildIndex = deferredRebuildIndex;
171    }
172
173    public void setIndexProperties(THiveIndexProperties indexProperties) {
174        this.indexProperties = indexProperties;
175    }
176
177    public boolean isDeferredRebuildIndex() {
178
179        return deferredRebuildIndex;
180    }
181
182    public THiveIndexProperties getIndexProperties() {
183        return indexProperties;
184    }
185
186    public void setAsTypeName(TObjectName asTypeName) {
187        this.asTypeName = asTypeName;
188    }
189
190    public TObjectName getAsTypeName() {
191
192        return asTypeName;
193    }
194
195    public TOrderByItemList getColumnNameList() {
196        return columnNameList;
197    }
198
199    public void setColumnNameList(TOrderByItemList columnNameList) {
200
201        this.columnNameList = columnNameList;
202    }
203
204    public void setTableName(TObjectName tableName) {
205        this.tableName = tableName;
206    }
207
208    public TObjectName getTableName() {
209
210        return tableName;
211    }
212
213    public void setIndexTypeViaToken(TSourceToken st){
214        if (st == null) return;
215        switch (st.tokencode){
216            case TBaseType.rrw_unique:
217                this.indexType = EIndexType.itUnique;
218                break;
219            default:
220                if (st.toString().equalsIgnoreCase("bitmap")){
221                    this.indexType = EIndexType.itBitMap;
222                }else if(st.toString().equalsIgnoreCase("fulltext")){
223                    this.indexType = EIndexType.itFulltext;
224                }else if(st.toString().equalsIgnoreCase("spatial")){
225                    this.indexType = EIndexType.itSpatial;
226                }
227                ;
228        }
229    }
230    public EIndexType getIndexType() {
231        return indexType;
232    }
233
234
235    public TObjectName getIndexName() {
236        return indexName;
237    }
238
239    public void init(Object arg1)
240   {
241       if (arg1 != null){
242          indexName = (TObjectName)arg1;
243          //indexName.setObjectType(TObjectName.ttobjIndexName);
244           indexName.setDbObjectType(EDbObjectType.index);
245       }
246   }
247
248    private TKeyspaceRef keyspaceRef;//couchbase
249
250    public void setKeyspaceRef(TKeyspaceRef keyspaceRef) {
251        this.keyspaceRef = keyspaceRef;
252    }
253
254    public TKeyspaceRef getKeyspaceRef() {
255
256        return keyspaceRef;
257    }
258
259    private TPTNodeList<TIndexKeyTerm> indexTerms;
260
261    public void setIndexTerms(TPTNodeList<TIndexKeyTerm> indexTerms) {
262        this.indexTerms = indexTerms;
263    }
264
265    public TPTNodeList<TIndexKeyTerm> getIndexTerms() {
266
267        return indexTerms;
268    }
269
270    private TExpressionList indexPartition;
271
272    public void setIndexPartition(TExpressionList indexPartition) {
273        this.indexPartition = indexPartition;
274    }
275
276    public TExpressionList getIndexPartition() {
277
278        return indexPartition;
279    }
280
281    private TExpression indexWhere;
282
283    public void setIndexWhere(TExpression indexWhere) {
284        this.indexWhere = indexWhere;
285    }
286
287    public TExpression getIndexWhere() {
288
289        return indexWhere;
290    }
291
292    private TExpression indexWith;
293
294    public void setIndexWith(TExpression indexWith) {
295        this.indexWith = indexWith;
296    }
297
298    public TExpression getIndexWith() {
299
300        return indexWith;
301    }
302}