c21 commented on a change in pull request #34497:
URL: https://github.com/apache/spark/pull/34497#discussion_r744306874



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1250,7 +1252,38 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with 
SQLConfHelper with Logg
    */
   override def visitTableName(ctx: TableNameContext): LogicalPlan = 
withOrigin(ctx) {
     val tableId = visitMultipartIdentifier(ctx.multipartIdentifier)
-    val table = mayApplyAliasPlan(ctx.tableAlias, UnresolvedRelation(tableId))
+    val properties = new util.HashMap[String, String]
+    if (ctx.asOf != null && ctx.asOf.version != null) {
+      properties.put(TableCatalog.PROP_VERSION, ctx.asOf.version.getText)

Review comment:
       Yes I agree, but in parser, we don't have any restriction for the 
`version` to be a valid `int` right? The parser just restricts the version to 
be a string only contains numbers - `[0-9]`. It is a nit but it might lead to 
surprising behavior in system when query sets a `version` to be larger than 
maximal int. I agree this is rare, but we can just check 
`ctx.asOf.version.getText.toInt` here to make sure the invalid `version` won't 
pass to downstream code and can fail earlier.
   
   ```
   fragment DIGIT
       : [0-9]
       ;
   
   INTEGER_VALUE
       : DIGIT+
       ;
   ```




-- 
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]

Reply via email to