Skip to content

Commit

Permalink
fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry-024 committed Dec 19, 2024
1 parent 09b4fbe commit da23974
Show file tree
Hide file tree
Showing 39 changed files with 73 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class MarkPartitionDoneProcedure extends ProcedureBase {

public String[] call(
ProcedureContext procedureContext, String tableId, String... partitionStrings)
throws Catalog.TableNotExistException, IOException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException, IOException {
checkArgument(
partitionStrings.length > 0,
"mark_partition_done procedure must specify partitions.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ protected FileStoreTable alterTableOptions(Identifier identifier, FileStoreTable
catalog.alterTable(identifier, optionChanges, false);
} catch (Catalog.TableNotExistException
| Catalog.ColumnAlreadyExistException
| Catalog.ColumnNotExistException e) {
| Catalog.ColumnNotExistException
| Catalog.TableNoPermissionException e) {
throw new RuntimeException("This is unexpected.", e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void processElement(StreamRecord<CdcMultiplexRecord> element) throws Exce
}
}

private FileStoreTable getTable(Identifier tableId) throws InterruptedException {
private FileStoreTable getTable(Identifier tableId) throws InterruptedException, Catalog.TableNoPermissionException {
FileStoreTable table = tables.get(tableId);
if (table == null) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Table buildPaimonTable(DynamicTableFactory.Context context) {
context.getObjectIdentifier().getObjectName());
try {
fileStoreTable = (FileStoreTable) flinkCatalog.catalog().getTable(identifier);
} catch (Catalog.TableNotExistException e) {
} catch (Catalog.TableNotExistException | Catalog.TableNoPermissionException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ private CatalogBaseTable getTable(ObjectPath tablePath, @Nullable Long timestamp
}

throw new TableNotExistException(getName(), tablePath);
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}

if (table instanceof FormatTable) {
Expand Down Expand Up @@ -369,6 +371,8 @@ public boolean tableExists(ObjectPath tablePath) throws CatalogException {
} catch (Catalog.ViewNotExistException ex) {
return false;
}
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}

Expand Down Expand Up @@ -401,6 +405,8 @@ public void dropTable(ObjectPath tablePath, boolean ignoreIfNotExists)
}
} catch (Catalog.TableNotExistException e) {
throw new TableNotExistException(getName(), tablePath);
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}

Expand Down Expand Up @@ -865,7 +871,9 @@ public void alterTable(
catalog.alterTable(toIdentifier(tablePath), changes, ignoreIfNotExists);
} catch (Catalog.TableNotExistException e) {
throw new TableNotExistException(getName(), tablePath);
} catch (Catalog.ColumnAlreadyExistException | Catalog.ColumnNotExistException e) {
} catch (Catalog.ColumnAlreadyExistException
| Catalog.ColumnNotExistException
| Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}
Expand All @@ -886,6 +894,8 @@ public void alterTable(
table = catalog.getTable(toIdentifier(tablePath));
} catch (Catalog.TableNotExistException e) {
throw new TableNotExistException(getName(), tablePath);
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}

checkArgument(
Expand Down Expand Up @@ -934,7 +944,8 @@ public void alterTable(
catalog.alterTable(toIdentifier(tablePath), changes, ignoreIfNotExists);
} catch (Catalog.TableNotExistException
| Catalog.ColumnAlreadyExistException
| Catalog.ColumnNotExistException e) {
| Catalog.ColumnNotExistException
| Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}
Expand Down Expand Up @@ -1249,6 +1260,8 @@ public final void renameTable(
}
} catch (Catalog.TableAlreadyExistException e) {
throw new TableAlreadyExistException(getName(), toTable);
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}

Expand Down Expand Up @@ -1313,6 +1326,8 @@ private Table getPaimonTable(ObjectPath tablePath) throws TableNotExistException
return catalog.getTable(identifier);
} catch (Catalog.TableNotExistException e) {
throw new TableNotExistException(getName(), tablePath);
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}

Expand Down Expand Up @@ -1564,6 +1579,8 @@ private void alterTableStatisticsInternal(
if (!ignoreIfNotExists) {
throw new TableNotExistException(getName(), tablePath);
}
} catch (Catalog.TableNoPermissionException e) {
throw new CatalogException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void buildForDividedMode() {
}
}
}
} catch (Catalog.DatabaseNotExistException | Catalog.TableNotExistException e) {
} catch (Catalog.DatabaseNotExistException | Catalog.TableNotExistException | Catalog.TableNoPermissionException e) {
throw new RuntimeException(e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class TableActionBase extends ActionBase {
identifier = new Identifier(databaseName, tableName);
try {
table = catalog.getTable(identifier);
} catch (Catalog.TableNotExistException e) {
} catch (Catalog.TableNotExistException | Catalog.TableNoPermissionException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void processElement(StreamRecord<CloneFileInfo> streamRecord) throws Exce
try {
return pathOfTable(
sourceCatalog.getTable(Identifier.fromString(key)));
} catch (Catalog.TableNotExistException e) {
} catch (Catalog.TableNotExistException | Catalog.TableNoPermissionException e) {
throw new RuntimeException(e);
}
});
Expand All @@ -93,7 +93,7 @@ public void processElement(StreamRecord<CloneFileInfo> streamRecord) throws Exce
try {
return pathOfTable(
targetCatalog.getTable(Identifier.fromString(key)));
} catch (Catalog.TableNotExistException e) {
} catch (Catalog.TableNotExistException | Catalog.TableNoPermissionException e) {
throw new RuntimeException(e);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public MultiTableScanBase(
}

protected void updateTableMap()
throws Catalog.DatabaseNotExistException, Catalog.TableNotExistException {
throws Catalog.DatabaseNotExistException, Catalog.TableNotExistException,
Catalog.TableNoPermissionException {
List<String> databases = catalog.listDatabases();

for (String databaseName : databases) {
Expand Down Expand Up @@ -102,7 +103,8 @@ protected void updateTableMap()
}

public ScanResult scanTable(ReaderOutput<T> ctx)
throws Catalog.TableNotExistException, Catalog.DatabaseNotExistException {
throws Catalog.TableNotExistException, Catalog.DatabaseNotExistException,
Catalog.TableNoPermissionException {
try {
updateTableMap();
List<T> tasks = doScan();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void registerLogSystem(
if (!tableOptions.get(LOG_SYSTEM).equalsIgnoreCase(NONE)) {
try {
catalog.getTable(identifier);
} catch (Catalog.TableNotExistException e) {
} catch (Catalog.TableNotExistException | Catalog.TableNoPermissionException e) {
LogStoreRegister logStoreRegister =
getLogStoreRegister(identifier, classLoader, tableOptions, logStore);
options.putAll(logStoreRegister.registerTopic());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ public static CleanOrphanFilesResult executeDatabaseOrphanFiles(
@Nullable Integer parallelism,
String databaseName,
@Nullable String tableName)
throws Catalog.DatabaseNotExistException, Catalog.TableNotExistException {
throws Catalog.DatabaseNotExistException, Catalog.TableNotExistException,
Catalog.TableNoPermissionException {
List<String> tableNames = Collections.singletonList(tableName);
if (tableName == null || "*".equals(tableName)) {
tableNames = catalog.listTables(databaseName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public String identifier() {
})
public String[] call(
ProcedureContext procedureContext, String tableId, String branchName, String tagName)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
if (!StringUtils.isBlank(tagName)) {
table.createBranch(branchName, tagName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String[] call(
String tagName,
@Nullable Long snapshotId,
@Nullable String timeRetained)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
createOrReplaceTag(table, tagName, snapshotId, toDuration(timeRetained));
return new String[] {"Success"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Row[] call(
String tagName,
Long timestamp,
@Nullable String timeRetained)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
FileStoreTable fileStoreTable = (FileStoreTable) table(tableId);
SnapshotManager snapshotManager = fileStoreTable.snapshotManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Row[] call(
String tagName,
Long watermark,
@Nullable String timeRetained)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
FileStoreTable fileStoreTable = (FileStoreTable) table(tableId);
SnapshotManager snapshotManager = fileStoreTable.snapshotManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public String identifier() {
@ArgumentHint(name = "branch", type = @DataTypeHint("STRING"))
})
public String[] call(ProcedureContext procedureContext, String tableId, String branchStr)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Identifier identifier = Identifier.fromString(tableId);
catalog.getTable(identifier).deleteBranches(branchStr);
catalog.invalidateTable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class DeleteTagProcedure extends ProcedureBase {
@ArgumentHint(name = "tag", type = @DataTypeHint("STRING"))
})
public String[] call(ProcedureContext procedureContext, String tableId, String tagNameStr)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
table.deleteTags(tagNameStr);
return new String[] {"Success"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class DropPartitionProcedure extends ProcedureBase {

public String[] call(
ProcedureContext procedureContext, String tableId, String... partitionStrings)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
checkArgument(
partitionStrings.length > 0, "drop-partition procedure must specify partitions.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String identifier() {
String timestampPattern,
String expireStrategy,
Integer maxExpires)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
FileStoreTable fileStoreTable = (FileStoreTable) table(tableId);
FileStore fileStore = fileStoreTable.store();
Map<String, String> map = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public String[] call(
Integer retainMin,
String olderThanStr,
Integer maxDeletes)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
ExpireSnapshots expireSnapshots = table(tableId).newExpireSnapshots();
ExpireConfig.Builder builder = ExpireConfig.builder();
if (retainMax != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ExpireTagsProcedure extends ProcedureBase {
})
public @DataTypeHint("ROW<expired_tags STRING>") Row[] call(
ProcedureContext procedureContext, String tableId, @Nullable String olderThanStr)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
FileStoreTable fileStoreTable = (FileStoreTable) table(tableId);
TagTimeExpire tagTimeExpire =
fileStoreTable.store().newTagCreationManager().getTagTimeExpire();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public String identifier() {
@ArgumentHint(name = "branch", type = @DataTypeHint("STRING"))
})
public String[] call(ProcedureContext procedureContext, String tableId, String branchName)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
return innerCall(tableId, branchName);
}

private String[] innerCall(String tableId, String branchName)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
table.fastForward(branchName);
return new String[] {"Success"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class MarkPartitionDoneProcedure extends ProcedureBase {
@ArgumentHint(name = "partitions", type = @DataTypeHint("STRING"))
})
public String[] call(ProcedureContext procedureContext, String tableId, String partitions)
throws Catalog.TableNotExistException, IOException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException, IOException {
String[] partitionStrings = partitions.split(";");
checkArgument(
partitionStrings.length > 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public ProcedureBase withCatalog(Catalog catalog) {
return this;
}

protected Table table(String tableId) throws Catalog.TableNotExistException {
protected Table table(String tableId)
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
return catalog.getTable(Identifier.fromString(tableId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class PurgeFilesProcedure extends ProcedureBase {

@ProcedureHint(argument = {@ArgumentHint(name = "table", type = @DataTypeHint("STRING"))})
public String[] call(ProcedureContext procedureContext, String tableId)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
FileStoreTable fileStoreTable = (FileStoreTable) table;
FileIO fileIO = fileStoreTable.fileIO();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class RefreshObjectTableProcedure extends ProcedureBase {
@ProcedureHint(argument = {@ArgumentHint(name = "table", type = @DataTypeHint("STRING"))})
public @DataTypeHint("ROW<file_number BIGINT>") Row[] call(
ProcedureContext procedureContext, String tableId)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
ObjectTable table = (ObjectTable) table(tableId);
long fileNumber = table.refresh();
return new Row[] {Row.of(fileNumber)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class RenameTagProcedure extends ProcedureBase {
})
public String[] call(
ProcedureContext procedureContext, String tableId, String tagName, String targetTagName)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
table.renameTag(tagName, targetTagName);
String ret = String.format("Rename [%s] to [%s] successfully.", tagName, targetTagName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public String[] call(
String tableId,
String consumerId,
Long nextSnapshotId)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
FileStoreTable fileStoreTable =
(FileStoreTable) catalog.getTable(Identifier.fromString(tableId));
ConsumerManager consumerManager =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class RollbackToProcedure extends ProcedureBase {
})
public String[] call(
ProcedureContext procedureContext, String tableId, String tagName, Long snapshotId)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
if (!StringUtils.isNullOrWhitespaceOnly(tagName)) {
table.rollbackTo(tagName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class RollbackToTimestampProcedure extends ProcedureBase {
@ArgumentHint(name = "timestamp", type = @DataTypeHint("BIGINT"))
})
public String[] call(ProcedureContext procedureContext, String tableId, Long timestamp)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
FileStoreTable fileStoreTable = (FileStoreTable) table;
Snapshot snapshot = fileStoreTable.snapshotManager().earlierOrEqualTimeMills(timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class RollbackToWatermarkProcedure extends ProcedureBase {
@ArgumentHint(name = "watermark", type = @DataTypeHint("BIGINT"))
})
public String[] call(ProcedureContext procedureContext, String tableId, Long watermark)
throws Catalog.TableNotExistException {
throws Catalog.TableNotExistException, Catalog.TableNoPermissionException {
Table table = catalog.getTable(Identifier.fromString(tableId));
FileStoreTable fileStoreTable = (FileStoreTable) table;
Snapshot snapshot = fileStoreTable.snapshotManager().earlierOrEqualWatermark(watermark);
Expand Down
Loading

0 comments on commit da23974

Please sign in to comment.