You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/23 18:33:57 UTC

[GitHub] [spark] rdblue commented on a change in pull request #28617: [SPARK-31694][SQL] Add SupportsPartitions Catalog APIs on DataSourceV2

rdblue commented on a change in pull request #28617:
URL: https://github.com/apache/spark/pull/28617#discussion_r459649004



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitions.java
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.spark.sql.connector.catalog;
+
+import java.util.Map;
+
+import org.apache.spark.annotation.Experimental;
+
+/**
+ * Catalog methods for working with Partitions.
+ */
+@Experimental
+public interface SupportsPartitions extends TableCatalog {

Review comment:
       What is the reason to extend `TableCatalog` instead of `Table`? I think it would be better to support partitions at a table level.
   
   Doing it this way creates more complexity for implementations because they need to handle more cases. For example, if the table doesn't exist, this should throw `NoSuchTableException` just like `loadTable`. It would be simpler for the API if these methods were used to manipulate a table, not to load _and_ manipulate a table. Loading should be orthogonal to partition operations.
   
   Another issue is that this assumes a table catalog contains tables that support partitions, or tables that do not. But Spark's built-in catalog supports some sources that don't expose partitions and some that do. This would cause more work for many catalogs, which would need to detect whether a table has support and throw `UnsupportedOperationException` if it does not. That also makes integration more difficult for Spark because it can't check a table in the analyzer to determine whether it supports the operation or not. Instead, Spark would need to handle exceptions at runtime.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org