rdblue commented on a change in pull request #1432: URL: https://github.com/apache/iceberg/pull/1432#discussion_r485979305
########## File path: core/src/main/java/org/apache/iceberg/MetadataTableUtils.java ########## @@ -0,0 +1,68 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.iceberg; + +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.exceptions.NoSuchTableException; + +public final class MetadataTableUtils { + private MetadataTableUtils() {} + + public static boolean isValidMetadataIdentifier(TableIdentifier identifier) { + return MetadataTableType.from(identifier.name()) != null && + isValidIdentifier(TableIdentifier.of(identifier.namespace().levels())); + } + + private static boolean isValidIdentifier(TableIdentifier tableIdentifier) { Review comment: I don't see much value in delegating to this method, since it assumes that the identifier is valid. Instead, I think we should just check that the identifier might reference a metadata table in `isValidMetadataIdentifier` and assume the remaining part is valid. After all, we'll have to load it anyway. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
