Skip to content

Commit

Permalink
deduplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
dchvn committed Dec 3, 2021
1 parent 9ce81a6 commit cba6519
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,8 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with SQLConfHelper with Logg
}

val partitioning = partitionExpressions(partTransforms, partCols, ctx)
val tableSpec = TableSpec(bucketSpec, properties, provider, options, location, comment,
serdeInfo, external)

Option(ctx.query).map(plan) match {
case Some(_) if columns.nonEmpty =>
Expand All @@ -3470,17 +3472,13 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with SQLConfHelper with Logg
ctx)

case Some(query) =>
val tableSpec = TableSpec(bucketSpec, properties, provider, options, location, comment,
serdeInfo, external)
CreateTableAsSelect(
UnresolvedDBObjectName(table, isNamespace = false),
partitioning, query, tableSpec, Map.empty, ifNotExists)

case _ =>
// Note: table schema includes both the table columns list and the partition columns
// with data type.
val tableSpec = TableSpec(bucketSpec, properties, provider, options, location, comment,
serdeInfo, external)
val schema = StructType(columns ++ partCols)
CreateTable(
UnresolvedDBObjectName(table, isNamespace = false),
Expand Down

0 comments on commit cba6519

Please sign in to comment.