Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
szehon-ho committed Jul 9, 2024
1 parent 8278aeb commit 7125656
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ relationPrimary
;

optionsClause
: WITH OPTIONS options=propertyList
: WITH options=propertyList
;

inlineTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2969,16 +2969,16 @@ class AstBuilder extends DataTypeAstBuilder with SQLConfHelper with Logging {
}

/**
* Create an [[UnresolvedRelation]] from an identifier reference.
*/
private def createUnresolvedRelation(identifier: IdentifierReferenceContext,
optionsClause: Option[OptionsClauseContext] = None): LogicalPlan =
withOrigin(identifier) {
val options = optionsClause.map{clause =>
new CaseInsensitiveStringMap(visitPropertyKeyValues(clause.options).asJava)
}.getOrElse(CaseInsensitiveStringMap.empty)
withIdentClause(identifier, parts =>
new UnresolvedRelation(parts, options, isStreaming = false))
* Create an [[UnresolvedRelation]] from an identifier reference and an options clause.
*/
private def createUnresolvedRelation(
ctx: IdentifierReferenceContext,
optionsClause: Option[OptionsClauseContext] = None): LogicalPlan = withOrigin(ctx) {
val options = optionsClause.map{ clause =>
new CaseInsensitiveStringMap(visitPropertyKeyValues(clause.options).asJava)
}.getOrElse(CaseInsensitiveStringMap.empty)
withIdentClause(ctx, parts =>
new UnresolvedRelation(parts, options, isStreaming = false))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3522,7 +3522,7 @@ class DataSourceV2SQLSuiteV1Filter
assert (collected.size == 1)
checkAnswer(df, Seq(Row(1, "a"), Row(2, "b")))

df = sql(s"SELECT * FROM $t1 WITH OPTIONS (`split-size` = 5)")
df = sql(s"SELECT * FROM $t1 WITH (`split-size` = 5)")
collected = df.queryExecution.optimizedPlan.collect {
case scan: DataSourceV2ScanRelation =>
assert(scan.relation.options.get("split-size") == "5")
Expand All @@ -3531,7 +3531,7 @@ class DataSourceV2SQLSuiteV1Filter
checkAnswer(df, Seq(Row(1, "a"), Row(2, "b")))

val noValues = intercept[AnalysisException](
sql(s"SELECT * FROM $t1 WITH OPTIONS (`split-size`)"))
sql(s"SELECT * FROM $t1 WITH (`split-size`)"))
assert(noValues.message.contains(
"Operation not allowed: Values must be specified for key(s): [split-size]"))
}
Expand Down

0 comments on commit 7125656

Please sign in to comment.