HyukjinKwon commented on a change in pull request #34072:
URL: https://github.com/apache/spark/pull/34072#discussion_r714462840
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1244,15 +1245,21 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef]
with SQLConfHelper with Logg
* }}}
*/
override def visitTable(ctx: TableContext): LogicalPlan = withOrigin(ctx) {
- UnresolvedRelation(visitMultipartIdentifier(ctx.multipartIdentifier))
+ val tableId = visitMultipartIdentifier(ctx.multipartIdentifier)
+ val options = Option(ctx.optionHint).map(hint =>
+ visitPropertyKeyValues(hint.options)).getOrElse(Map.empty)
+ UnresolvedRelation(tableId, new CaseInsensitiveStringMap(options.asJava))
}
/**
* Create an aliased table reference. This is typically used in FROM clauses.
*/
override def visitTableName(ctx: TableNameContext): LogicalPlan =
withOrigin(ctx) {
val tableId = visitMultipartIdentifier(ctx.multipartIdentifier)
- val table = mayApplyAliasPlan(ctx.tableAlias, UnresolvedRelation(tableId))
+ val options = Option(ctx.optionHint).map(hint =>
+ visitPropertyKeyValues(hint.options)).getOrElse(Map.empty)
+ val table = mayApplyAliasPlan(ctx.tableAlias,
+ UnresolvedRelation(tableId, new
CaseInsensitiveStringMap(options.asJava)))
Review comment:
I don't think this works for the tables already defined with options
because Spark respects the table properties defined in the table. This
`options` is only for DSv2 for now. Can you add an e2e test, and see if it
works? e.g.) create a table view and set the option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]