advancedxy commented on a change in pull request #34497:
URL: https://github.com/apache/spark/pull/34497#discussion_r744346748
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1250,7 +1252,40 @@ 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)
+ } else if (ctx.asOf != null && ctx.asOf.TIMESTAMP != null) {
+ val ts = ctx.asOf.timestamp.getText
+ if (ts.length == "'yyyy-MM-dd'".length) {
Review comment:
how about we just use
`org.apache.spark.sql.catalyst.util.DateTimeUtils#parseTimestampString` here
and make sure the timestamp parsing logic is consistent in Spark SQL?
Also why should we to match `'yyyy-MM-dd'` here?
Could
```
select * from t as of "2019-01-29 00:37:58"
```
be a valid statement?
##########
File path:
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableCatalog.java
##########
@@ -71,6 +71,16 @@
*/
String OPTION_PREFIX = "option.";
+ /**
+ * A reserved property to specify the version of the table.
+ */
+ String PROP_VERSION = "versionAsOf";
Review comment:
Since we are using `version` and `timestamp` in the following
`loadTable` methods, do you think it's better to simply use `version` and
`timestamp` here for `PROP_VERSION` and `PROP_TIMESTAMP`?
--
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]