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/17 13:45:46 UTC

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

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



##########
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 {
+
+    /**
+     * Create partitions in an existing table, assuming it exists.
+     *
+     * @param ident a table identifier
+     * @param partitions transforms to use for partitioning data in the table
+     * @param ignoreIfExists
+     */
+    void createPartitions(
+            Identifier ident,
+            TablePartition[] partitions,
+            Boolean ignoreIfExists);
+
+    /**
+     * Drop partitions from a table, assuming they exist.
+     *
+     * @param ident a table identifier
+     * @param partitions a list of string map for existing partitions
+     * @param ignoreIfNotExists
+     */
+    void dropPartitions(
+            Identifier ident,
+            Map<String, String>[] partitions,

Review comment:
       TablePartition Contains the partition metadata, it's too heavy for this. As for Transform, it maybe a good choice if it can pass partition value.

##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TablePartition.java
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+public class TablePartition {

Review comment:
       Thanks for your CR.
   Transform doest not contains actual partition values and partition metadata. In many cases, we need to know the metadata of a partition.
   Please correct me if there is something wrong.




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