001package gudusoft.gsqlparser.nodes.hive; 002/* 003 * Date: 13-8-9 004 */ 005 006import gudusoft.gsqlparser.nodes.TObjectName; 007import gudusoft.gsqlparser.nodes.TParseTreeNode; 008import gudusoft.gsqlparser.nodes.TPartitionExtensionClause; 009 010public class THiveShowSqlNode extends TParseTreeNode { 011 private EHiveShowType showType; 012 private TObjectName showIdentifier; 013 private TObjectName dbName; 014 private TObjectName tableName; 015 private TObjectName functionName; 016 017 public boolean isExtended() { 018 return isExtended; 019 } 020 021 public TPartitionExtensionClause getPartitionSpec() { 022 return partitionSpec; 023 } 024 025 public TObjectName getPropertyName() { 026 return propertyName; 027 } 028 029 public EHiveDescOption getShowOptions() { 030 return showOptions; 031 } 032 033 public THiveDescTablePartition getTablePartition() { 034 return tablePartition; 035 } 036 037 private TPartitionExtensionClause partitionSpec; 038 private TObjectName propertyName; 039 private boolean isExtended; 040 private THiveDescTablePartition tablePartition; 041 private EHiveDescOption showOptions; 042 043 public TObjectName getFunctionName() { 044 return functionName; 045 } 046 047 public TObjectName getTableName() { 048 return tableName; 049 } 050 051 public TObjectName getShowIdentifier() { 052 return showIdentifier; 053 } 054 055 public EHiveShowType getShowType() { 056 return showType; 057 } 058 059 public TObjectName getDbName() { 060 return dbName; 061 } 062 063 public void setDbName(TObjectName dbName) { 064 this.dbName = dbName; 065 } 066 067 public void setTableName(TObjectName tableName) { 068 this.tableName = tableName; 069 } 070 071 072 public void init(Object arg1,Object arg2){ 073 showType = (EHiveShowType)arg1; 074 switch (showType){ 075 case stColumns: 076 tableName = (TObjectName)arg2; 077 break; 078 case stFunctions: 079 functionName = (TObjectName)arg2; 080 break; 081 case stPartitions: 082 showIdentifier = (TObjectName)arg2; 083 break; 084 case stCreateTable: 085 tableName = (TObjectName)arg2; 086 break; 087 case stTableStatus: 088 showIdentifier = (TObjectName)arg2; 089 break; 090 case stTableProperties: 091 tableName = (TObjectName)arg2; 092 break; 093 case stLocks: 094 isExtended = (arg2 != null); 095 break; 096 case stConf: 097 showIdentifier = (TObjectName)arg2; 098 break; 099 case stTransactions: 100 case stCompactions: 101 break; 102 case stIndexes: 103 if (arg2 != null) 104 showOptions = EHiveDescOption.doFormatted; 105 break; 106 default: 107 showIdentifier = (TObjectName)arg2; 108 break; 109 } 110 111 112 } 113 114 115 public void init(Object arg1,Object arg2,Object arg3){ 116 init(arg1,arg2); 117 switch (showType){ 118 case stColumns: 119 dbName = (TObjectName)arg3; 120 break; 121 case stPartitions: 122 partitionSpec = (TPartitionExtensionClause)arg3; 123 break; 124 case stTableStatus: 125 partitionSpec = (TPartitionExtensionClause)arg3; 126 break; 127 case stTableProperties: 128 propertyName = (TObjectName)arg3; 129 break; 130 case stLocks: 131 tablePartition = (THiveDescTablePartition)arg3; 132 break; 133 case stIndexes: 134 tableName = (TObjectName)arg3; 135 break; 136 default: 137 dbName = (TObjectName)arg3; 138 break; 139 } 140 } 141 142 public void init(Object arg1,Object arg2,Object arg3,Object arg4){ 143 init(arg1,arg2,arg3); 144 switch (showType){ 145 case stTableStatus: 146 tableName = (TObjectName)arg4; 147 break; 148 case stIndexes: 149 dbName = (TObjectName)arg4; 150 break; 151 default: 152 break; 153 } 154 155 } 156 157 158}