001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty; 004 005/** 006 * AST node for StarRocks BACKUP SNAPSHOT statement. 007 * 008 * Syntax (v3.4.0+): 009 * BACKUP [DATABASE <db_name>] SNAPSHOT [<db_name>.]<snapshot_name> 010 * TO <repository_name> 011 * [ON ( backup_object [, ...] )] 012 * [PROPERTIES ("key"="value" [, ...])] 013 * 014 * backup_object: 015 * { ALL TABLES | TABLES <table_name>[, ...] } | 016 * { ALL MATERIALIZED VIEWS | MATERIALIZED VIEWS <mv_name>[, ...] } | 017 * { ALL VIEWS | VIEWS <view_name>[, ...] } | 018 * { ALL FUNCTIONS | FUNCTIONS <udf_name>[, ...] } | 019 * <table_name> PARTITION (<partition_name>[, ...]) 020 * 021 * Example: 022 * BACKUP DATABASE sr_hub SNAPSHOT sr_hub_backup TO test_repo 023 * ON (TABLE sr_member PARTITION (p1, p2, p3)) 024 * PROPERTIES ("type" = "full"); 025 */ 026public class TBackupSnapshotSqlNode extends TParseTreeNode { 027 // DATABASE clause - optional database name 028 private TObjectName databaseName; 029 030 // Has explicit DATABASE keyword 031 private boolean hasDatabase; 032 033 // SNAPSHOT name (may be qualified as db.snapshot_name) 034 private TObjectName snapshotName; 035 036 // TO clause - repository name 037 private TObjectName repositoryName; 038 039 // ON clause - objects to backup 040 // Can contain: ALL TABLES, TABLES list, ALL MATERIALIZED VIEWS, MATERIALIZED VIEWS list, 041 // ALL VIEWS, VIEWS list, ALL FUNCTIONS, FUNCTIONS list, or table with partitions 042 private TParseTreeNode backupObjects; 043 044 // Flags for ALL object types 045 private boolean allTables; 046 private boolean allMaterializedViews; 047 private boolean allViews; 048 private boolean allFunctions; 049 050 // Object type for ON clause (tables, materialized_views, views, functions) 051 private String objectType; 052 053 // List of specific objects (tables, views, mvs, functions) 054 private TObjectNameList objectList; 055 056 // Table name for partition backup 057 private TObjectName partitionTableName; 058 059 // Partition list for specific table backup 060 private TObjectNameList partitionList; 061 062 // PROPERTIES clause 063 private TParseTreeNode properties; 064 065 // Getters and setters 066 public TObjectName getDatabaseName() { 067 return databaseName; 068 } 069 070 public void setDatabaseName(TObjectName databaseName) { 071 this.databaseName = databaseName; 072 } 073 074 public boolean hasDatabase() { 075 return hasDatabase; 076 } 077 078 public void setHasDatabase(boolean hasDatabase) { 079 this.hasDatabase = hasDatabase; 080 } 081 082 public TObjectName getSnapshotName() { 083 return snapshotName; 084 } 085 086 public void setSnapshotName(TObjectName snapshotName) { 087 this.snapshotName = snapshotName; 088 } 089 090 public TObjectName getRepositoryName() { 091 return repositoryName; 092 } 093 094 public void setRepositoryName(TObjectName repositoryName) { 095 this.repositoryName = repositoryName; 096 } 097 098 public TParseTreeNode getBackupObjects() { 099 return backupObjects; 100 } 101 102 public void setBackupObjects(TParseTreeNode backupObjects) { 103 this.backupObjects = backupObjects; 104 } 105 106 public boolean isAllTables() { 107 return allTables; 108 } 109 110 public void setAllTables(boolean allTables) { 111 this.allTables = allTables; 112 } 113 114 public boolean isAllMaterializedViews() { 115 return allMaterializedViews; 116 } 117 118 public void setAllMaterializedViews(boolean allMaterializedViews) { 119 this.allMaterializedViews = allMaterializedViews; 120 } 121 122 public boolean isAllViews() { 123 return allViews; 124 } 125 126 public void setAllViews(boolean allViews) { 127 this.allViews = allViews; 128 } 129 130 public boolean isAllFunctions() { 131 return allFunctions; 132 } 133 134 public void setAllFunctions(boolean allFunctions) { 135 this.allFunctions = allFunctions; 136 } 137 138 public String getObjectType() { 139 return objectType; 140 } 141 142 public void setObjectType(String objectType) { 143 this.objectType = objectType; 144 } 145 146 public TObjectNameList getObjectList() { 147 return objectList; 148 } 149 150 public void setObjectList(TObjectNameList objectList) { 151 this.objectList = objectList; 152 } 153 154 public TObjectName getPartitionTableName() { 155 return partitionTableName; 156 } 157 158 public void setPartitionTableName(TObjectName partitionTableName) { 159 this.partitionTableName = partitionTableName; 160 } 161 162 public TObjectNameList getPartitionList() { 163 return partitionList; 164 } 165 166 public void setPartitionList(TObjectNameList partitionList) { 167 this.partitionList = partitionList; 168 } 169 170 @SuppressWarnings("unchecked") 171 public TPTNodeList<TFlinkTableProperty> getProperties() { 172 return (TPTNodeList<TFlinkTableProperty>) properties; 173 } 174 175 public void setProperties(TParseTreeNode properties) { 176 this.properties = properties; 177 } 178 179 public void init(Object arg1) { 180 this.snapshotName = (TObjectName) arg1; 181 } 182}