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 064 public void init(Object arg1,Object arg2){ 065 showType = (EHiveShowType)arg1; 066 switch (showType){ 067 case stColumns: 068 tableName = (TObjectName)arg2; 069 break; 070 case stFunctions: 071 functionName = (TObjectName)arg2; 072 break; 073 case stPartitions: 074 showIdentifier = (TObjectName)arg2; 075 break; 076 case stCreateTable: 077 tableName = (TObjectName)arg2; 078 break; 079 case stTableStatus: 080 showIdentifier = (TObjectName)arg2; 081 break; 082 case stTableProperties: 083 tableName = (TObjectName)arg2; 084 break; 085 case stLocks: 086 isExtended = (arg2 != null); 087 break; 088 case stIndexes: 089 if (arg2 != null) 090 showOptions = EHiveDescOption.doFormatted; 091 break; 092 default: 093 showIdentifier = (TObjectName)arg2; 094 break; 095 } 096 097 098 } 099 100 101 public void init(Object arg1,Object arg2,Object arg3){ 102 init(arg1,arg2); 103 switch (showType){ 104 case stColumns: 105 dbName = (TObjectName)arg3; 106 break; 107 case stPartitions: 108 partitionSpec = (TPartitionExtensionClause)arg3; 109 break; 110 case stTableStatus: 111 partitionSpec = (TPartitionExtensionClause)arg2; 112 break; 113 case stTableProperties: 114 propertyName = (TObjectName)arg3; 115 break; 116 case stLocks: 117 tablePartition = (THiveDescTablePartition)arg3; 118 break; 119 case stIndexes: 120 tableName = (TObjectName)arg3; 121 break; 122 default: 123 dbName = (TObjectName)arg3; 124 break; 125 } 126 } 127 128 public void init(Object arg1,Object arg2,Object arg3,Object arg4){ 129 init(arg1,arg2,arg3); 130 switch (showType){ 131 case stTableStatus: 132 tableName = (TObjectName)arg4; 133 break; 134 case stIndexes: 135 dbName = (TObjectName)arg4; 136 break; 137 default: 138 break; 139 } 140 141 } 142 143 144}