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

    https://github.com/apache/spark/pull/11189#discussion_r53572202
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
 ---
    @@ -174,40 +207,65 @@ case class TablePartition(
      * Note that Hive's metastore also tracks skewed columns. We should 
consider adding that in the
      * future once we have a better understanding of how we want to handle 
skewed columns.
      */
    -case class Table(
    -  name: String,
    -  description: String,
    -  schema: Seq[Column],
    -  partitionColumns: Seq[Column],
    -  sortColumns: Seq[Column],
    -  storage: StorageFormat,
    -  numBuckets: Int,
    -  properties: Map[String, String],
    -  tableType: String,
    -  createTime: Long,
    -  lastAccessTime: Long,
    -  viewOriginalText: Option[String],
    -  viewText: Option[String]) {
    -
    -  require(tableType == "EXTERNAL_TABLE" || tableType == "INDEX_TABLE" ||
    -    tableType == "MANAGED_TABLE" || tableType == "VIRTUAL_VIEW")
    +case class CatalogTable(
    +    specifiedDatabase: Option[String],
    +    name: String,
    +    tableType: CatalogTableType,
    +    storage: CatalogStorageFormat,
    +    schema: Seq[CatalogColumn],
    +    partitionColumns: Seq[CatalogColumn] = Seq.empty,
    +    sortColumns: Seq[CatalogColumn] = Seq.empty,
    +    numBuckets: Int = 0,
    +    createTime: Long = System.currentTimeMillis,
    +    lastAccessTime: Long = System.currentTimeMillis,
    +    properties: Map[String, String] = Map.empty,
    +    viewOriginalText: Option[String] = None,
    +    viewText: Option[String] = None) {
    +
    +  /** Return the database this table was specified to belong to, assuming 
it exists. */
    +  def database: String = specifiedDatabase.getOrElse {
    +    throw new AnalysisException(s"table $name did not specify database")
    +  }
    +
    +  /** Return the fully qualified name of this table, assuming the database 
was specified. */
    +  def qualifiedName: String = s"$database.$name"
    +
    +  /** Syntactic sugar to update a field in `storage`. */
    +  def withNewStorage(
    +      locationUri: Option[String] = storage.locationUri,
    +      inputFormat: Option[String] = storage.inputFormat,
    +      outputFormat: Option[String] = storage.outputFormat,
    +      serde: Option[String] = storage.serde,
    +      serdeProperties: Map[String, String] = storage.serdeProperties): 
CatalogTable = {
    +    copy(storage = CatalogStorageFormat(
    +      locationUri, inputFormat, outputFormat, serde, serdeProperties))
    +  }
    +
    +}
    +
    +
    +case class CatalogTableType private(name: String)
    +object CatalogTableType {
    +  val EXTERNAL_TABLE = new CatalogTableType("EXTERNAL_TABLE")
    +  val MANAGED_TABLE = new CatalogTableType("MANAGED_TABLE")
    +  val INDEX_TABLE = new CatalogTableType("INDEX_TABLE")
    +  val VIRTUAL_VIEW = new CatalogTableType("VIRTUAL_VIEW")
     }
     
     
     /**
      * A database defined in the catalog.
      */
    -case class Database(
    -  name: String,
    -  description: String,
    -  locationUri: String,
    -  properties: Map[String, String]
    -)
    +case class CatalogDatabase(
    +    name: String,
    +    description: String,
    +    locationUri: String,
    +    properties: Map[String, String])
     
     
     object Catalog {
       /**
        * Specifications of a table partition indexed by column name.
    --- End diff --
    
    Column Name -> Value?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to