xabriel commented on a change in pull request #458: Add metadata tables for
path-based tables
URL: https://github.com/apache/incubator-iceberg/pull/458#discussion_r322834290
##########
File path: core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java
##########
@@ -60,12 +66,51 @@ public HadoopTables(Configuration conf) {
public Table load(String location) {
TableOperations ops = newTableOps(location);
if (ops.current() == null) {
- throw new NoSuchTableException("Table does not exist at location: " +
location);
+ // 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) {
Review comment:
Thanks @chenjunjiedada. I'd rather keep simple code if there is no concrete
example of an issue or security concern?
Consider existing code in `IcebergSource` that does a simple check on the
string to see if it looks like a path:
https://github.com/apache/incubator-iceberg/blob/master/spark/src/main/java/org/apache/iceberg/spark/source/IcebergSource.java#L109-L111.
You could do it with a regex instead, but so much simpler to just check for
`contains("/")`.
@rdblue and @aokolnychyi, any preference?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]