001package gudusoft.gsqlparser.nodes; 002 003 004import gudusoft.gsqlparser.EAlterViewOption; 005import gudusoft.gsqlparser.EDbObjectType; 006import gudusoft.gsqlparser.TSourceToken; 007import gudusoft.gsqlparser.nodes.hive.THiveKeyValueProperty; 008 009import java.util.ArrayList; 010 011public class TAlterViewSqlNode extends TParseTreeNode { 012 013 private String comment; 014 015 public String getComment() { 016 return comment; 017 } 018 019 public TObjectName getSchemaName() { 020 return schemaName; 021 } 022 023 private TObjectName schemaName; 024 private TObjectName ownerName; 025 private TObjectName viewName; 026 027 public TObjectName getOwnerName() { 028 return ownerName; 029 } 030 031 private EAlterViewOption alterViewOption; 032 private TObjectName newViewName; 033 private TSelectSqlNode selectSqlNode; 034 private TViewAliasClause viewAliasClause = null; 035 036 public void setViewAliasClause(TViewAliasClause viewAliasClause) { 037 this.viewAliasClause = viewAliasClause; 038 } 039 040 041 public TSelectSqlNode getSelectSqlNode() { 042 return selectSqlNode; 043 } 044 045 private ArrayList<TPartitionExtensionClause> partitionSpecs; 046 public ArrayList<TPartitionExtensionClause> getPartitionSpecs() { 047 return partitionSpecs; 048 } 049 050 private TPTNodeList <THiveKeyValueProperty> tableProperties; 051 052 public TObjectName getViewName() { 053 return viewName; 054 } 055 056 public void init(Object arg1,Object arg2){ 057 alterViewOption = (EAlterViewOption)arg1; 058 viewName = (TObjectName)arg2; 059 viewName.setDbObjectType(EDbObjectType.view); 060 } 061 062 public void init(Object arg1){ 063 viewName = (TObjectName)arg1; 064 viewName.setDbObjectType(EDbObjectType.view); 065 } 066 067 public EAlterViewOption getAlterViewOption() { 068 return alterViewOption; 069 } 070 071 public TObjectName getNewViewName() { 072 return newViewName; 073 } 074 075 public void setNewViewName(TObjectName newViewName) { 076 this.newViewName = newViewName; 077 } 078 079 public TPTNodeList<THiveKeyValueProperty> getTableProperties() { 080 return tableProperties; 081 } 082 083 public void setOwnerName(TObjectName ownerName) { 084 this.ownerName = ownerName; 085 } 086 087 public void init(Object arg1,Object arg2,Object arg3){ 088 init(arg1,arg2); 089 switch (alterViewOption){ 090 case setTableProperties: 091 tableProperties = (TPTNodeList)arg3; 092 break; 093 case rename: 094 newViewName = (TObjectName)arg3; 095 newViewName.setDbObjectType(EDbObjectType.view); 096 break; 097 case addPartitionSpecs: 098 partitionSpecs = (ArrayList<TPartitionExtensionClause>)arg3; 099 break; 100 case dropPartitionSpecs: 101 partitionSpecs = (ArrayList<TPartitionExtensionClause>)arg3; 102 break; 103 case asSelect: 104 selectSqlNode = (TSelectSqlNode)arg3; 105 break; 106 case ownerTo: 107 ownerName = (TObjectName)arg3; 108 break; 109 case setSchema: 110 schemaName = (TObjectName)arg3; 111 break; 112 case setComment: 113 this.comment = ((TSourceToken)arg3).toString(); 114 break; 115 default: 116 break; 117 } 118 } 119}