rdblue commented on a change in pull request #1342:
URL: https://github.com/apache/iceberg/pull/1342#discussion_r470832379
##########
File path: core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java
##########
@@ -68,27 +71,26 @@ public HadoopTables(Configuration conf) {
*/
@Override
public Table load(String location) {
- TableOperations ops = newTableOps(location);
- if (ops.current() == null) {
+ //Possibly Load a Metadata Table
+ if (location.contains("#") && !location.endsWith("#")) {
// try to resolve a metadata table, which we encode as URI fragments
// e.g. hdfs:///warehouse/my_table#snapshots
int hashIndex = location.lastIndexOf('#');
- if (hashIndex != -1 && location.length() - 1 != hashIndex) {
- // we found char '#', and it is not the last char of location
- String baseTable = location.substring(0, hashIndex);
- String metaTable = location.substring(hashIndex + 1);
- MetadataTableType type = MetadataTableType.from(metaTable);
- if (type != null) {
- return loadMetadataTable(baseTable, type);
- } else {
- throw new NoSuchTableException("Table does not exist at location: "
+ location);
- }
- } else {
- throw new NoSuchTableException("Table does not exist at location: " +
location);
+ String baseTable = location.substring(0, hashIndex);
+ String metaTable = location.substring(hashIndex + 1);
+ MetadataTableType type = MetadataTableType.from(metaTable);
+ if (type != null) {
+ return loadMetadataTable(baseTable, type);
}
}
- return new BaseTable(ops, location);
+ //Normal Table Load if we haven't loaded a MetadataTable
Review comment:
A couple of style nits: There should be a space before the start of the
comment text, and we typically use sentence case, unless referring to specific
objects, like MetadataTable (no need to capitalize "Table" and "Load").
----------------------------------------------------------------
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]