Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/12271#discussion_r59118235
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
---
@@ -218,14 +219,35 @@ case class CatalogTable(
tableType: CatalogTableType,
storage: CatalogStorageFormat,
schema: Seq[CatalogColumn],
- partitionColumns: Seq[CatalogColumn] = Seq.empty,
- sortColumns: Seq[CatalogColumn] = Seq.empty,
+ partitionColumnNames: Seq[String] = Seq.empty,
+ sortColumnNames: Seq[String] = Seq.empty,
+ bucketColumnNames: Seq[String] = Seq.empty,
+ // e.g. (date, country)
+ skewColumnNames: Seq[String] = Seq.empty,
+ // e.g. ('2008-08-08', 'us), ('2009-09-09', 'uk')
+ skewColumnValues: Seq[Seq[String]] = 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) {
+ viewText: Option[String] = None,
+ comment: Option[String] = None) {
+
+ // Verify that the provided columns are part of the schema
+ private val colNames = schema.map(_.name).toSet
+ private def requireSubsetOfSchema(cols: Seq[String], colType: String):
Unit = {
+ require(cols.toSet.subsetOf(colNames), s"$colType columns
(${cols.mkString(", ")}) " +
+ s"must be a subset of schema (${colNames.mkString(", ")}) in table
'$identifier'")
+ }
+ requireSubsetOfSchema(partitionColumnNames, "partition")
--- End diff --
I find the following example from Hive's doc
```
CREATE TABLE page_view(viewTime INT, userid BIGINT,
page_url STRING, referrer_url STRING,
ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(dt STRING, country STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\001'
STORED AS SEQUENCEFILE;
```
Will this CREATE TABLE statement trigger an error at here?
---
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]