Github user rdblue commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21306#discussion_r200824504
  
    --- Diff: 
sql/core/src/main/java/org/apache/spark/sql/sources/v2/catalog/TableCatalog.java
 ---
    @@ -0,0 +1,123 @@
    +/*
    + * 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.sources.v2.catalog;
    +
    +import org.apache.spark.sql.catalyst.TableIdentifier;
    +import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
    +import org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException;
    +import org.apache.spark.sql.catalyst.expressions.Expression;
    +import org.apache.spark.sql.types.StructType;
    +
    +import java.util.Arrays;
    +import java.util.Collections;
    +import java.util.List;
    +import java.util.Map;
    +
    +public interface TableCatalog {
    +  /**
    +   * Load table metadata by {@link TableIdentifier identifier} from the 
catalog.
    +   *
    +   * @param ident a table identifier
    +   * @return the table's metadata
    +   * @throws NoSuchTableException If the table doesn't exist.
    +   */
    +  Table loadTable(TableIdentifier ident) throws NoSuchTableException;
    +
    +  /**
    +   * Create a table in the catalog.
    +   *
    +   * @param ident a table identifier
    +   * @param schema the schema of the new table, as a struct type
    +   * @return metadata for the new table
    +   * @throws TableAlreadyExistsException If a table already exists for the 
identifier
    +   */
    +  default Table createTable(TableIdentifier ident,
    +                            StructType schema) throws 
TableAlreadyExistsException {
    +    return createTable(ident, schema, Collections.emptyList(), 
Collections.emptyMap());
    +  }
    +
    +  /**
    +   * Create a table in the catalog.
    +   *
    +   * @param ident a table identifier
    +   * @param schema the schema of the new table, as a struct type
    +   * @param properties a string map of table properties
    +   * @return metadata for the new table
    +   * @throws TableAlreadyExistsException If a table already exists for the 
identifier
    +   */
    +  default Table createTable(TableIdentifier ident,
    +                            StructType schema,
    +                            Map<String, String> properties) throws 
TableAlreadyExistsException {
    +    return createTable(ident, schema, Collections.emptyList(), properties);
    +  }
    +
    +  /**
    +   * Create a table in the catalog.
    +   *
    +   * @param ident a table identifier
    +   * @param schema the schema of the new table, as a struct type
    +   * @param partitions a list of expressions to use for partitioning data 
in the table
    +   * @param properties a string map of table properties
    +   * @return metadata for the new table
    +   * @throws TableAlreadyExistsException If a table already exists for the 
identifier
    +   */
    +  Table createTable(TableIdentifier ident,
    +                    StructType schema,
    +                    List<Expression> partitions,
    --- End diff --
    
    I wouldn't say this way of passing partitioning is a new feature. It's just 
a generalization of the existing partitioning that allows us to pass any type 
of partition, whether it is bucketing or column-based.
    
    As for open discussion, this was proposed in the SPIP that was fairly 
widely read and commented on. That SPIP was posted to the dev list a few times, 
too. I do appreciate you wanting to make sure there's been a chance for the 
community to discuss it, but there has been plenty of opportunity to comment. 
At this point, I think it's reasonable to move forward with the implementation.


---

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

Reply via email to