You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/09/06 23:02:49 UTC

[GitHub] [incubator-iceberg] rdblue commented on a change in pull request #458: Add metadata tables for path-based tables

rdblue 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_r321936253
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java
 ##########
 @@ -60,12 +68,50 @@ 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 {
+        // try to resolve a metadata table, which are encoded as URI fragments
+        // e.g. hdfs:///warehouse/my_table#snapshots
+        URI meta = new URI(location);
 
 Review comment:
   Java's URI class is tricky. Its getters don't return what was parsed from the original `String` and you have to use the "raw" getters to get the URL-encoded versions. And, its constructors will escape characters. In the past, I've run into situations where I can't actually reproduce the original URI in all cases because of the escape and un-escape behavior of these methods. And even if we can, these problems require extensive testing.
   
   So it's better _not_ to use URI where possible. In this case, the fragment must be the [last component of a URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Generic_syntax) so we should be able to parse it out of the string and then pass the string on instead of using URI at all. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org