001package gudusoft.gsqlparser.stmt.hive; 002/* 003 * Date: 13-7-29 004 */ 005 006import gudusoft.gsqlparser.EDbVendor; 007import gudusoft.gsqlparser.ESqlStatementType; 008import gudusoft.gsqlparser.TCustomSqlStatement; 009import gudusoft.gsqlparser.nodes.TObjectName; 010import gudusoft.gsqlparser.nodes.TParseTreeVisitor; 011import gudusoft.gsqlparser.nodes.hive.*; 012 013public class THiveDescribe extends TCustomSqlStatement { 014 015 private EHiveDescribleType describleType; 016 private TObjectName functionName; 017 private TObjectName dbName; 018 private TObjectName columnName; 019 private THiveDescTablePartition tablePartition; 020 private EHiveDescOption descOption; 021 022 023 public THiveDescribe(EDbVendor dbvendor) { 024 super(dbvendor); 025 sqlstatementtype = ESqlStatementType.ssthiveDesc; 026 } 027 028 public TObjectName getDbName() { 029 return dbName; 030 } 031 032 public EHiveDescOption getDescOption() { 033 return descOption; 034 } 035 036 public EHiveDescribleType getDescribleType() { 037 return describleType; 038 } 039 040 public TObjectName getFunctionName() { 041 return functionName; 042 } 043 044 public THiveDescTablePartition getTablePartition() { 045 return tablePartition; 046 } 047 048 public int doParseStatement(TCustomSqlStatement psql) { 049 if (rootNode == null) return -1; 050 super.doParseStatement(psql); 051 THiveDescribeSqlNode node = (THiveDescribeSqlNode)rootNode; 052 053 this.dbName = node.getDbName(); 054 this.functionName = node.getDbName(); 055 this.columnName = node.getColumnName(); 056 this.descOption = node.getDescOption(); 057 this.tablePartition = node.getTablePartition(); 058 this.describleType = node.getDescribleType(); 059 060 061 062 return 0; 063 } 064 065 public void accept(TParseTreeVisitor v){ 066 v.preVisit(this); 067 v.postVisit(this); 068 } 069 070 public void acceptChildren(TParseTreeVisitor v){ 071 v.preVisit(this); 072 v.postVisit(this); 073 } 074 075 public void setDescribleType(EHiveDescribleType describleType) { 076 this.describleType = describleType; 077 } 078 079 public void setFunctionName(TObjectName functionName) { 080 this.functionName = functionName; 081 } 082 083 public void setDbName(TObjectName dbName) { 084 this.dbName = dbName; 085 } 086 087 public void setTablePartition(THiveDescTablePartition tablePartition) { 088 this.tablePartition = tablePartition; 089 } 090 091 public void setDescOption(EHiveDescOption descOption) { 092 this.descOption = descOption; 093 } 094 095 public TObjectName getColumnName() { 096 return columnName; 097 } 098 099 public void setColumnName(TObjectName columnName) { 100 this.columnName = columnName; 101 } 102}