001package gudusoft.gsqlparser.nodes.hive; 002/* 003 * Date: 13-8-9 004 */ 005 006import gudusoft.gsqlparser.TBaseType; 007import gudusoft.gsqlparser.TSourceToken; 008import gudusoft.gsqlparser.nodes.TObjectName; 009import gudusoft.gsqlparser.nodes.TParseTreeNode; 010 011public class THiveDescribeSqlNode extends TParseTreeNode { 012 private EHiveDescribleType describleType; 013 private TObjectName functionName; 014 private TObjectName dbName; 015 private THiveDescTablePartition tablePartition; 016 private EHiveDescOption descOption; 017 018 public void setDescOption(TSourceToken token) { 019 if (token == null) return; 020 if (token.tokencode == TBaseType.rrw_formatted){ 021 this.descOption = EHiveDescOption.doFormatted; 022 }else if (token.tokencode == TBaseType.rrw_extended){ 023 this.descOption = EHiveDescOption.doExtended; 024 }else if (token.tokencode == TBaseType.rrw_pretty){ 025 this.descOption = EHiveDescOption.doPretty; 026 } 027 } 028 029 public EHiveDescOption getDescOption() { 030 031 return descOption; 032 } 033 034 public TObjectName getDbName() { 035 return dbName; 036 } 037 038 public EHiveDescribleType getDescribleType() { 039 return describleType; 040 } 041 042 public TObjectName getFunctionName() { 043 return functionName; 044 } 045 046 public THiveDescTablePartition getTablePartition() { 047 return tablePartition; 048 } 049 050 public void init(Object arg1, Object arg2){ 051 describleType = (EHiveDescribleType)arg1; 052 switch (describleType){ 053 case dtTablePartition: 054 tablePartition = (THiveDescTablePartition)arg2; 055 break; 056 case dtFunction: 057 functionName = (TObjectName)arg2; 058 break; 059 case dtDatabase: 060 dbName = (TObjectName)arg2; 061 062 break; 063 } 064 } 065 066}