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