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 2022/02/25 20:31:42 UTC

[GitHub] [iceberg] rdblue opened a new pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

rdblue opened a new pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231


   This continues cleaning up the JDBC implementation after #4220 and adds namespace tests to validate the behavior of the JDBC catalog and other catalogs that support namespace properties.
   
   * Creates a base set of catalog tests that check namespace behavior
   * Consolidates JDBC exception handling by combining logic in `fetch`, `exists`, and `execute` helper methods
   * Fixes namespace listing that needs to combine namespaces that exist from properties or tables


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] rdblue commented on pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
rdblue commented on pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231#issuecomment-1051301367


   Thanks for the review, @danielcweeks!


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] rdblue merged pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
rdblue merged pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231


   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] danielcweeks commented on a change in pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
danielcweeks commented on a change in pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231#discussion_r815150673



##########
File path: core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
##########
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.catalog;
+
+import com.google.common.collect.Sets;

Review comment:
       I think you need to use relocated here.




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] danielcweeks commented on a change in pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
danielcweeks commented on a change in pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231#discussion_r815147201



##########
File path: core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java
##########
@@ -446,190 +402,153 @@ public void close() {
 
   @Override
   public boolean namespaceExists(Namespace namespace) {
+    if (exists(JdbcUtil.GET_NAMESPACE_SQL, catalogName, JdbcUtil.namespaceToString(namespace) + "%")) {
+      return true;
+    }
+
+    if (exists(JdbcUtil.GET_NAMESPACE_PROPERTIES_SQL, catalogName, JdbcUtil.namespaceToString(namespace) + "%")) {
+      return true;
+    }
+
+    return false;
+  }
+
+  private int execute(String sql, String... args) {
+    return execute(err -> {}, sql, args);
+  }
+
+  private int execute(Consumer<SQLException> sqlErrorHandler, String sql, String... args) {

Review comment:
       Error handler seems unnecessary since it's never used and throws anyway (as opposed to delegating to the handler).  




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] rdblue commented on a change in pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231#discussion_r815150500



##########
File path: core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java
##########
@@ -446,190 +402,153 @@ public void close() {
 
   @Override
   public boolean namespaceExists(Namespace namespace) {
+    if (exists(JdbcUtil.GET_NAMESPACE_SQL, catalogName, JdbcUtil.namespaceToString(namespace) + "%")) {
+      return true;
+    }
+
+    if (exists(JdbcUtil.GET_NAMESPACE_PROPERTIES_SQL, catalogName, JdbcUtil.namespaceToString(namespace) + "%")) {
+      return true;
+    }
+
+    return false;
+  }
+
+  private int execute(String sql, String... args) {
+    return execute(err -> {}, sql, args);
+  }
+
+  private int execute(Consumer<SQLException> sqlErrorHandler, String sql, String... args) {

Review comment:
       This is used in one case: https://github.com/apache/iceberg/pull/4231/files#diff-a5f7966c7493d463facbf7e76fe0fa3db1b637d29ee12e5b3628a5e5dd289e0aR195
   
   I did this to avoid having a SQLException try/catch in every method.




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] rdblue commented on a change in pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231#discussion_r815151235



##########
File path: core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java
##########
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.catalog;
+
+import com.google.common.collect.Sets;

Review comment:
       Fixed.




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [iceberg] danielcweeks commented on a change in pull request #4231: Core: Clean up JDBC implementation, add catalog namespace tests

Posted by GitBox <gi...@apache.org>.
danielcweeks commented on a change in pull request #4231:
URL: https://github.com/apache/iceberg/pull/4231#discussion_r815151058



##########
File path: core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java
##########
@@ -446,190 +402,153 @@ public void close() {
 
   @Override
   public boolean namespaceExists(Namespace namespace) {
+    if (exists(JdbcUtil.GET_NAMESPACE_SQL, catalogName, JdbcUtil.namespaceToString(namespace) + "%")) {
+      return true;
+    }
+
+    if (exists(JdbcUtil.GET_NAMESPACE_PROPERTIES_SQL, catalogName, JdbcUtil.namespaceToString(namespace) + "%")) {
+      return true;
+    }
+
+    return false;
+  }
+
+  private int execute(String sql, String... args) {
+    return execute(err -> {}, sql, args);
+  }
+
+  private int execute(Consumer<SQLException> sqlErrorHandler, String sql, String... args) {

Review comment:
       Makes sense.  Missed that usage.




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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