You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by andrewor14 <gi...@git.apache.org> on 2016/04/27 03:06:17 UTC

[GitHub] spark pull request: [SPARK-13477][SQL] Expose new user-facing Cata...

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

    https://github.com/apache/spark/pull/12713#discussion_r61190163
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala ---
    @@ -0,0 +1,209 @@
    +/*
    + * 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.catalog
    +
    +import org.apache.spark.annotation.Experimental
    +import org.apache.spark.sql.{AnalysisException, DataFrame}
    +import org.apache.spark.sql.types.StructType
    +
    +
    +// TODO: make these methods return Datasets instead of Array
    +
    +/**
    + * Catalog interface for Spark. To access this, use `SparkSession.catalog`.
    + */
    +abstract class Catalog {
    +
    +  /**
    +   * Returns the current default database in this session.
    +   */
    +  def currentDatabase: String
    +
    +  /**
    +   * Sets the current default database in this session.
    +   */
    +  def setCurrentDatabase(dbName: String): Unit
    +
    +  /**
    +   * Returns a list of databases available across all sessions.
    +   */
    +  def listDatabases(): Array[Database]
    +
    +  /**
    +   * Returns a list of tables in the current database.
    +   * This includes all temporary tables.
    +   */
    +  def listTables(): Array[Table]
    +
    +  /**
    +   * Returns a list of tables in the specified database.
    +   * This includes all temporary tables.
    +   */
    +  @throws[AnalysisException]("database does not exist")
    +  def listTables(dbName: String): Array[Table]
    +
    +  /**
    +   * Returns a list of functions registered in the current database.
    +   * This includes all temporary functions
    +   */
    +  def listFunctions(): Array[Function]
    +
    +  /**
    +   * Returns a list of functions registered in the specified database.
    +   * This includes all temporary functions
    +   */
    +  @throws[AnalysisException]("database does not exist")
    +  def listFunctions(dbName: String): Array[Function]
    +
    +  /**
    +   * Returns a list of columns for the given table in the current database.
    +   */
    +  @throws[AnalysisException]("table does not exist")
    +  def listColumns(tableName: String): Array[Column]
    +
    +  /**
    +   * Returns a list of columns for the given table in the specified database.
    --- End diff --
    
    add some annotations


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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