Skip to content

Commit

Permalink
rdar://111955881 (Differentiate Create Table Unordered from Create Ta…
Browse files Browse the repository at this point in the history
…ble default) (apache#1810)

Co-authored-by: Russell Spitzer <russell.spitzer@gmail.com>
  • Loading branch information
2 people authored and GitHub Enterprise committed Jul 9, 2023
1 parent e1060ab commit 2a5afba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4381,7 +4381,11 @@ class AstBuilder extends SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit
val ordering = toOrdering(orderingSpec)

val table = createUnresolvedTable(ctx.multipartIdentifier, "ALTER TABLE ... WRITE")
SetWriteDistributionAndOrdering(table, distributionMode, ordering)
if (distributionMode == "unordered") {
SetWriteDistributionAndOrdering(table, "none", ordering)
} else {
SetWriteDistributionAndOrdering(table, distributionMode, ordering)
}
}

private def toDistributionMode(
Expand All @@ -4391,7 +4395,8 @@ class AstBuilder extends SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit
if (distributionSpec != null) {
"hash"
} else if (orderingSpec.UNORDERED != null || orderingSpec.LOCALLY != null) {
"none"
// Need to distinguish between "none" (default) and explicitly unordered
"unordered"
} else {
"range"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3134,7 +3134,7 @@ class PlanResolutionSuite extends AnalysisTest {
.add("description", StringType)
.add("point", new StructType().add("x", DoubleType).add("y", DoubleType)))
assert(create.partitioning == expectedPartitioning)
assert(create.distributionMode == "none")
assert(create.distributionMode == "unordered")
assert(create.ordering == expectedOrdering)
assert(create.tableSpec.properties == expectedProperties)
assert(create.ignoreIfExists)
Expand Down Expand Up @@ -3167,7 +3167,7 @@ class PlanResolutionSuite extends AnalysisTest {
assert(ctas.tableSpec.properties == expectedProperties)
assert(ctas.writeOptions.isEmpty)
assert(ctas.partitioning.isEmpty)
assert(ctas.distributionMode == "none")
assert(ctas.distributionMode == "unordered")
assert(ctas.ordering.isEmpty)
assert(ctas.ignoreIfExists)

Expand Down

0 comments on commit 2a5afba

Please sign in to comment.