001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty; 004 005/** 006 * AST node for StarRocks RESTORE SNAPSHOT statement. 007 * 008 * Syntax (v3.4.0+): 009 * RESTORE SNAPSHOT [<db_name>.]<snapshot_name> 010 * FROM <repository_name> 011 * [DATABASE <db_name_in_snapshot> [AS <target_db>]] 012 * [ON ( restore_object [, ...] )] 013 * [PROPERTIES ("key"="value" [, ...])] 014 * 015 * restore_object: 016 * { ALL TABLES | TABLES <table_name>[, ...] [AS <alias>] } | 017 * { ALL MATERIALIZED VIEWS | MATERIALIZED VIEWS <mv_name>[, ...] [AS <alias>] } | 018 * { ALL VIEWS | VIEWS <view_name>[, ...] [AS <alias>] } | 019 * { ALL FUNCTIONS | FUNCTIONS <udf_name>[, ...] [AS <alias>] } | 020 * <table_name> PARTITION (<partition_name>[, ...]) [AS <alias>] 021 * 022 * Example: 023 * RESTORE SNAPSHOT sr_hub_backup 024 * FROM test_repo 025 * DATABASE sr_hub AS sr_hub_new 026 * ON (TABLE sr_member AS new_member) 027 * PROPERTIES ("backup_timestamp" = "2024-12-09-10-25-58-842"); 028 */ 029public class TRestoreSnapshotSqlNode extends TParseTreeNode { 030 // SNAPSHOT name (may be qualified as db.snapshot_name) 031 private TObjectName snapshotName; 032 033 // FROM clause - repository name 034 private TObjectName repositoryName; 035 036 // DATABASE clause - source database name in snapshot 037 private TObjectName sourceDatabaseName; 038 039 // DATABASE ... AS clause - target database name for restore 040 private TObjectName targetDatabaseName; 041 042 // Has explicit DATABASE keyword 043 private boolean hasDatabase; 044 045 // ON clause - objects to restore 046 private TParseTreeNode restoreObjects; 047 048 // Flags for ALL object types 049 private boolean allTables; 050 private boolean allMaterializedViews; 051 private boolean allViews; 052 private boolean allFunctions; 053 054 // Object type for ON clause (tables, materialized_views, views, functions) 055 private String objectType; 056 057 // List of specific objects (tables, views, mvs, functions) 058 private TObjectNameList objectList; 059 060 // Alias for object list (AS clause) 061 private TObjectName objectAlias; 062 063 // Table name for partition restore 064 private TObjectName partitionTableName; 065 066 // Partition list for specific table restore 067 private TObjectNameList partitionList; 068 069 // Alias for partition table (AS clause) 070 private TObjectName partitionTableAlias; 071 072 // PROPERTIES clause 073 private TParseTreeNode properties; 074 075 // Getters and setters 076 public TObjectName getSnapshotName() { 077 return snapshotName; 078 } 079 080 public void setSnapshotName(TObjectName snapshotName) { 081 this.snapshotName = snapshotName; 082 } 083 084 public TObjectName getRepositoryName() { 085 return repositoryName; 086 } 087 088 public void setRepositoryName(TObjectName repositoryName) { 089 this.repositoryName = repositoryName; 090 } 091 092 public TObjectName getSourceDatabaseName() { 093 return sourceDatabaseName; 094 } 095 096 public void setSourceDatabaseName(TObjectName sourceDatabaseName) { 097 this.sourceDatabaseName = sourceDatabaseName; 098 } 099 100 public TObjectName getTargetDatabaseName() { 101 return targetDatabaseName; 102 } 103 104 public void setTargetDatabaseName(TObjectName targetDatabaseName) { 105 this.targetDatabaseName = targetDatabaseName; 106 } 107 108 public boolean hasDatabase() { 109 return hasDatabase; 110 } 111 112 public void setHasDatabase(boolean hasDatabase) { 113 this.hasDatabase = hasDatabase; 114 } 115 116 public TParseTreeNode getRestoreObjects() { 117 return restoreObjects; 118 } 119 120 public void setRestoreObjects(TParseTreeNode restoreObjects) { 121 this.restoreObjects = restoreObjects; 122 } 123 124 public boolean isAllTables() { 125 return allTables; 126 } 127 128 public void setAllTables(boolean allTables) { 129 this.allTables = allTables; 130 } 131 132 public boolean isAllMaterializedViews() { 133 return allMaterializedViews; 134 } 135 136 public void setAllMaterializedViews(boolean allMaterializedViews) { 137 this.allMaterializedViews = allMaterializedViews; 138 } 139 140 public boolean isAllViews() { 141 return allViews; 142 } 143 144 public void setAllViews(boolean allViews) { 145 this.allViews = allViews; 146 } 147 148 public boolean isAllFunctions() { 149 return allFunctions; 150 } 151 152 public void setAllFunctions(boolean allFunctions) { 153 this.allFunctions = allFunctions; 154 } 155 156 public String getObjectType() { 157 return objectType; 158 } 159 160 public void setObjectType(String objectType) { 161 this.objectType = objectType; 162 } 163 164 public TObjectNameList getObjectList() { 165 return objectList; 166 } 167 168 public void setObjectList(TObjectNameList objectList) { 169 this.objectList = objectList; 170 } 171 172 public TObjectName getObjectAlias() { 173 return objectAlias; 174 } 175 176 public void setObjectAlias(TObjectName objectAlias) { 177 this.objectAlias = objectAlias; 178 } 179 180 public TObjectName getPartitionTableName() { 181 return partitionTableName; 182 } 183 184 public void setPartitionTableName(TObjectName partitionTableName) { 185 this.partitionTableName = partitionTableName; 186 } 187 188 public TObjectNameList getPartitionList() { 189 return partitionList; 190 } 191 192 public void setPartitionList(TObjectNameList partitionList) { 193 this.partitionList = partitionList; 194 } 195 196 public TObjectName getPartitionTableAlias() { 197 return partitionTableAlias; 198 } 199 200 public void setPartitionTableAlias(TObjectName partitionTableAlias) { 201 this.partitionTableAlias = partitionTableAlias; 202 } 203 204 @SuppressWarnings("unchecked") 205 public TPTNodeList<TFlinkTableProperty> getProperties() { 206 return (TPTNodeList<TFlinkTableProperty>) properties; 207 } 208 209 public void setProperties(TParseTreeNode properties) { 210 this.properties = properties; 211 } 212 213 public void init(Object arg1) { 214 this.snapshotName = (TObjectName) arg1; 215 } 216}