Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,15 @@ protected void authorizeBasicTableLikeOperationOrThrow(
PolarisResolvedPathWrapper target =
resolutionManifest.getResolvedPath(identifier, PolarisEntityType.TABLE_LIKE, subType, true);
if (target == null) {
if (subType == PolarisEntitySubType.ICEBERG_TABLE) {
throw new NoSuchTableException("Table does not exist: %s", identifier);
} else if (subType == PolarisEntitySubType.GENERIC_TABLE) {
throw new NoSuchTableException("Generic table does not exist: %s", identifier);
} else {
throw new NoSuchViewException("View does not exist: %s", identifier);
switch (subType) {
case PolarisEntitySubType.ICEBERG_TABLE:
throw new NoSuchTableException("Table does not exist: %s", identifier);

case PolarisEntitySubType.GENERIC_TABLE:
throw new NoSuchTableException("Generic table does not exist: %s", identifier);

default:
throw new NoSuchViewException("View does not exist: %s", identifier);
}
}
authorizer.authorizeOrThrow(
Expand Down Expand Up @@ -334,13 +337,20 @@ protected void authorizeRenameTableLikeOperationOrThrow(
// TODO: Possibly modify the exception thrown depending on whether the caller has privileges
// on the parent namespace.
PolarisEntitySubType dstLeafSubType = resolutionManifest.getLeafSubType(dst);
if (dstLeafSubType == PolarisEntitySubType.ICEBERG_TABLE) {
throw new AlreadyExistsException("Cannot rename %s to %s. Table already exists", src, dst);
} else if (dstLeafSubType == PolarisEntitySubType.ICEBERG_VIEW) {
throw new AlreadyExistsException("Cannot rename %s to %s. View already exists", src, dst);
} else if (dstLeafSubType == PolarisEntitySubType.GENERIC_TABLE) {
throw new AlreadyExistsException(
"Cannot rename %s to %s. Generic table already exists", src, dst);

switch (dstLeafSubType) {
case PolarisEntitySubType.ICEBERG_TABLE:
throw new AlreadyExistsException("Cannot rename %s to %s. Table already exists", src, dst);

case PolarisEntitySubType.ICEBERG_VIEW:
throw new AlreadyExistsException("Cannot rename %s to %s. View already exists", src, dst);

case PolarisEntitySubType.GENERIC_TABLE:
throw new AlreadyExistsException(
"Cannot rename %s to %s. Generic table already exists", src, dst);

default:
break;
}

PolarisResolvedPathWrapper target =
Expand Down