You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yhuai <gi...@git.apache.org> on 2016/08/22 22:55:23 UTC
[GitHub] spark pull request #14572: [SPARK-17192] [SQL] Issue Exception when Users Sp...
Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/14572#discussion_r75774405
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala ---
@@ -72,29 +72,19 @@ case class PreprocessDDL(conf: SQLConf) extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
// When we CREATE TABLE without specifying the table schema, we should fail the query if
- // bucketing information is specified, as we can't infer bucketing from data files currently,
- // and we should ignore the partition columns if it's specified, as we will infer it later, at
- // runtime.
+ // bucketing information is specified, as we can't infer bucketing from data files currently.
+ // Since the runtime inferred partition columns could be different from what user specified,
+ // we fail the query if the partitioning information is specified.
case c @ CreateTable(tableDesc, _, None) if tableDesc.schema.isEmpty =>
if (tableDesc.bucketSpec.isDefined) {
failAnalysis("Cannot specify bucketing information if the table schema is not specified " +
"when creating and will be inferred at runtime")
}
-
- val partitionColumnNames = tableDesc.partitionColumnNames
- if (partitionColumnNames.nonEmpty) {
- // The table does not have a specified schema, which means that the schema will be inferred
- // at runtime. So, we are not expecting partition columns and we will discover partitions
- // at runtime. However, if there are specified partition columns, we simply ignore them and
- // provide a warning message.
- logWarning(
- s"Specified partition columns (${partitionColumnNames.mkString(",")}) will be " +
- s"ignored. The schema and partition columns of table ${tableDesc.identifier} will " +
- "be inferred.")
- c.copy(tableDesc = tableDesc.copy(partitionColumnNames = Nil))
- } else {
- c
+ if (tableDesc.partitionColumnNames.nonEmpty) {
+ failAnalysis("Cannot specify partition information if the table schema is not specified " +
+ "when creating and will be inferred at runtime")
}
+ c
--- End diff --
How about `It is not allowed to specify partition columns when the table schema is not defined. When the table schema is not provided, schema and partition columns will be inferred.`?
---
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