Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3379,7 +3379,9 @@ class AstBuilder extends DataTypeAstBuilder with SQLConfHelper with Logging {
ctx: ExpressionPropertyListContext): OptionList = {
val options = ctx.expressionProperty.asScala.map { property =>
val key: String = visitPropertyKey(property.key)
val value: Expression = Option(property.value).map(expression).orNull
val value: Expression = Option(property.value).map(expression).getOrElse {
operationNotAllowed(s"A value must be specified for the key: $key.", ctx)
}
key -> value
}.toSeq
OptionList(options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,18 @@ class DDLParserSuite extends AnalysisTest {
stop = 42))
}

test("SPARK-46610: throw exception when no value for a key in create table options") {
val createTableSql = "create table test_table using my_data_source options (password)"
checkError(
exception = parseException(createTableSql),
errorClass = "_LEGACY_ERROR_TEMP_0035",
parameters = Map("message" -> "A value must be specified for the key: password."),
context = ExpectedContext(
fragment = createTableSql,
start = 0,
stop = 62))
}

test("UNCACHE TABLE") {
comparePlans(
parsePlan("UNCACHE TABLE a.b.c"),
Expand Down