@@ -220,12 +220,15 @@ protected void authorizeBasicTableLikeOperationOrThrow(
220
220
PolarisResolvedPathWrapper target =
221
221
resolutionManifest .getResolvedPath (identifier , PolarisEntityType .TABLE_LIKE , subType , true );
222
222
if (target == null ) {
223
- if (subType == PolarisEntitySubType .ICEBERG_TABLE ) {
224
- throw new NoSuchTableException ("Table does not exist: %s" , identifier );
225
- } else if (subType == PolarisEntitySubType .GENERIC_TABLE ) {
226
- throw new NoSuchTableException ("Generic table does not exist: %s" , identifier );
227
- } else {
228
- throw new NoSuchViewException ("View does not exist: %s" , identifier );
223
+ switch (subType ) {
224
+ case PolarisEntitySubType .ICEBERG_TABLE :
225
+ throw new NoSuchTableException ("Table does not exist: %s" , identifier );
226
+
227
+ case PolarisEntitySubType .GENERIC_TABLE :
228
+ throw new NoSuchTableException ("Generic table does not exist: %s" , identifier );
229
+
230
+ default :
231
+ throw new NoSuchViewException ("View does not exist: %s" , identifier );
229
232
}
230
233
}
231
234
authorizer .authorizeOrThrow (
@@ -334,13 +337,20 @@ protected void authorizeRenameTableLikeOperationOrThrow(
334
337
// TODO: Possibly modify the exception thrown depending on whether the caller has privileges
335
338
// on the parent namespace.
336
339
PolarisEntitySubType dstLeafSubType = resolutionManifest .getLeafSubType (dst );
337
- if (dstLeafSubType == PolarisEntitySubType .ICEBERG_TABLE ) {
338
- throw new AlreadyExistsException ("Cannot rename %s to %s. Table already exists" , src , dst );
339
- } else if (dstLeafSubType == PolarisEntitySubType .ICEBERG_VIEW ) {
340
- throw new AlreadyExistsException ("Cannot rename %s to %s. View already exists" , src , dst );
341
- } else if (dstLeafSubType == PolarisEntitySubType .GENERIC_TABLE ) {
342
- throw new AlreadyExistsException (
343
- "Cannot rename %s to %s. Generic table already exists" , src , dst );
340
+
341
+ switch (dstLeafSubType ) {
342
+ case PolarisEntitySubType .ICEBERG_TABLE :
343
+ throw new AlreadyExistsException ("Cannot rename %s to %s. Table already exists" , src , dst );
344
+
345
+ case PolarisEntitySubType .ICEBERG_VIEW :
346
+ throw new AlreadyExistsException ("Cannot rename %s to %s. View already exists" , src , dst );
347
+
348
+ case PolarisEntitySubType .GENERIC_TABLE :
349
+ throw new AlreadyExistsException (
350
+ "Cannot rename %s to %s. Generic table already exists" , src , dst );
351
+
352
+ default :
353
+ break ;
344
354
}
345
355
346
356
PolarisResolvedPathWrapper target =
0 commit comments