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 2021/10/25 12:50:59 UTC

[GitHub] [iceberg] snazy opened a new pull request #3367: WIP/DRAFT Procedure provider

snazy opened a new pull request #3367:
URL: https://github.com/apache/iceberg/pull/3367


   Fixes #3254
   
   /cc @karuppayya @aokolnychyi would an approach like this one work for you as well?


-- 
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] snazy commented on pull request #3367: WIP/DRAFT Procedure provider

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


   For us (Nessie) it's rather an Iceberg thing, because the specialized procedures only work with the Nessie-Iceberg catalog. I think, that's the same for the existing procedures. (Not sure how to do it yet, but it would probably make sense to call those procedures from Flink as well.)


-- 
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 #3367: WIP/DRAFT Procedure provider

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


   @snazy, @aokolnychyi, I'm not sure that adding the ability to plug in stored procedures is a good idea for Iceberg or for Spark in general.
   
   Stored procedures are part of Iceberg's Spark extensions because we wanted a way to call actions before we could get stored procedures upstream in Spark. Adding more complexity here reduces the chances that we will be able to get the interfaces added to Spark, so I would prefer not to add too much here that risks not being able to move it upstream.
   
   In addition, I'm not sure that this fits with how code is plugged into Spark. I think that stored procedures should be added through a catalog that can define them. Catalogs are the primary way to plug things like this into Spark, so I'm not sure why Spark would support a second way to plug in specific procedures. How a catalog manages procedures is up to the implementation. We could add this as an Iceberg catalog feature, but then this may be different. So we should first clarify: is this an Iceberg-only feature or is this something that would go upstream?


-- 
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] jackye1995 edited a comment on pull request #3367: WIP/DRAFT Procedure provider

Posted by GitBox <gi...@apache.org>.
jackye1995 edited a comment on pull request #3367:
URL: https://github.com/apache/iceberg/pull/3367#issuecomment-952399204


   So far `Catalog` has been a pluggable concept for cloud service integrations. It does not affect any Iceberg specific features, those are always controlled by the compute engine. Now we are saying that the `NessieCatalog` itself is more or less a compute engine that has its own list of unique features that other catalog cannot use. This is a big shift of the Iceberg catalog concept, and people can no longer easily switch across different implementations because of these catalog-specific procedures. it almost feel to me that Nessie should just implement another `NessieSparkCatalog` for Nessie users, and you can freely add all the extensions you'd like to have. Or we should try to push it as a Spark feature to easily register procedures from not a single but multiple sources.
   
   I am also curious what approach you are taking for Delta Lake. They also have `io.delta.sql.DeltaSparkSessionExtension`, are you also adding a similar hook on their side?


-- 
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 #3367: WIP/DRAFT Procedure provider

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



##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureBuilder.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.spark.procedures;
+
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.iceberg.catalog.Procedure;
+
+/** Builder interface to create a new {@link Procedure} instance. */
+public interface ProcedureBuilder {
+
+  ProcedureBuilder withTableCatalog(TableCatalog tableCatalog);
+
+  Procedure build();
+
+  /**
+   * Helper class to create a {@link ProcedureBuilder}.
+   * @param <T> type of the procedure.
+   */
+  abstract class Builder<T extends Procedure> implements ProcedureBuilder {
+    private TableCatalog tableCatalog;
+
+    @Override
+    public Builder<T> withTableCatalog(TableCatalog newTableCatalog) {
+      this.tableCatalog = newTableCatalog;
+      return this;
+    }
+
+    @Override
+    public T build() {
+      return doBuild();
+    }
+
+    protected abstract T doBuild();
+
+    TableCatalog tableCatalog() {
+      return tableCatalog;

Review comment:
       Why is an accessor needed for the table catalog?




-- 
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] jackye1995 commented on pull request #3367: WIP/DRAFT Procedure provider

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


   So far `Catalog` has been a pluggable concept for cloud service integrations. It does not affect any Iceberg specific features, those are always controlled by the compute engine. Now we are saying that the `NessieCatalog` itself is more or less a compute engine that has its own list of unique features that other catalog cannot use. This is a big shift to the Iceberg catalog concept, and people can no longer easily switch across different implementations because of these catalog-specific procedures. it almost feel to me that Nessie should just implement another `NessieSparkCatalog` for Nessie users, and you can freely add all the extensions you'd like to have.
   
   I am also curious what approach you are taking for Delta Lake. They also have `io.delta.sql.DeltaSparkSessionExtension`, are you also adding a similar hook on their side?


-- 
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] jackye1995 edited a comment on pull request #3367: WIP/DRAFT Procedure provider

Posted by GitBox <gi...@apache.org>.
jackye1995 edited a comment on pull request #3367:
URL: https://github.com/apache/iceberg/pull/3367#issuecomment-952399204


   So far `Catalog` has been a pluggable concept for cloud service integrations. It does not affect any Iceberg specific features, those are always controlled by the compute engine. Now we are saying that the `NessieCatalog` itself is more or less a compute engine that has its own list of unique features that other catalog cannot use. This is a big shift of the Iceberg catalog concept, and people can no longer easily switch across different implementations because of these catalog-specific procedures. it almost feel to me that Nessie should just implement another `NessieSparkCatalog` for Nessie users, and you can freely add all the extensions you'd like to have.
   
   I am also curious what approach you are taking for Delta Lake. They also have `io.delta.sql.DeltaSparkSessionExtension`, are you also adding a similar hook on their side?


-- 
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 #3367: WIP/DRAFT Procedure provider

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



##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureBuilder.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.spark.procedures;
+
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.iceberg.catalog.Procedure;
+
+/** Builder interface to create a new {@link Procedure} instance. */
+public interface ProcedureBuilder {
+
+  ProcedureBuilder withTableCatalog(TableCatalog tableCatalog);
+
+  Procedure build();
+
+  /**
+   * Helper class to create a {@link ProcedureBuilder}.
+   * @param <T> type of the procedure.
+   */
+  abstract class Builder<T extends Procedure> implements ProcedureBuilder {
+    private TableCatalog tableCatalog;
+
+    @Override
+    public Builder<T> withTableCatalog(TableCatalog newTableCatalog) {
+      this.tableCatalog = newTableCatalog;
+      return this;
+    }
+
+    @Override
+    public T build() {
+      return doBuild();

Review comment:
       Why not make `build` abstract instead of `doBuild`?




-- 
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 #3367: WIP/DRAFT Procedure provider

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



##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureBuilder.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.spark.procedures;
+
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.iceberg.catalog.Procedure;
+
+/** Builder interface to create a new {@link Procedure} instance. */
+public interface ProcedureBuilder {
+
+  ProcedureBuilder withTableCatalog(TableCatalog tableCatalog);

Review comment:
       Should this be a plugin instead of a specific catalog type? I think it should be able to detect if the catalog is a `TableCatalog` internally rather than requiring the procedure catalog to be a table catalog.




-- 
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 #3367: WIP/DRAFT Procedure provider

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



##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureProvider.java
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.spark.procedures;
+
+import java.util.Map;
+import java.util.function.Supplier;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+
+/**
+ * Provides a set of procedures to be registered in a {@link org.apache.iceberg.spark.SparkCatalog SparkCatalog} or
+ * {@link org.apache.iceberg.spark.SparkSessionCatalog SparkSessionCatalog} using the
+ * {@link Namespace namespace} returned by {@link #getNamespace()}.
+ *
+ * <p>Instances of this class are discovered using Java's {@link java.util.ServiceLoader} mechanism.
+ */
+public interface ProcedureProvider {
+  /** Name of this {@link ProcedureProvider}. */
+  String getName();

Review comment:
       Can you update this to follow the Iceberg project style?
   * `get` should not be used in method names (use a more specific verb, or omit it)
   * Javadoc should be multi-line and should include `@return`
   * Javadoc with more than one paragraph should use `<p>` on its own line to separate paragraphs




-- 
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] snazy commented on a change in pull request #3367: WIP/DRAFT Procedure provider

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



##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/ProcedureBuilder.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.spark.procedures;
+
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.iceberg.catalog.Procedure;
+
+/** Builder interface to create a new {@link Procedure} instance. */
+public interface ProcedureBuilder {
+
+  ProcedureBuilder withTableCatalog(TableCatalog tableCatalog);
+
+  Procedure build();
+
+  /**
+   * Helper class to create a {@link ProcedureBuilder}.
+   * @param <T> type of the procedure.
+   */
+  abstract class Builder<T extends Procedure> implements ProcedureBuilder {
+    private TableCatalog tableCatalog;
+
+    @Override
+    public Builder<T> withTableCatalog(TableCatalog newTableCatalog) {
+      this.tableCatalog = newTableCatalog;
+      return this;
+    }
+
+    @Override
+    public T build() {
+      return doBuild();

Review comment:
       I just moved this interface out of `SparkProcedures` (same for `ProcedureBuilder.Builder`) but haven't done any change to that stuff.




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