iffyio commented on code in PR #2134:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2134#discussion_r2629488296


##########
tests/sqlparser_bigquery.rs:
##########
@@ -1753,6 +1753,10 @@ fn parse_table_time_travel() {
 
     let sql = "SELECT 1 FROM t1 FOR SYSTEM TIME AS OF 
'some_timestamp'".to_string();
     assert!(bigquery().parse_sql_statements(&sql).is_err());
+
+    // The following time travel syntax(es) are invalid in BigQuery dialect

Review Comment:
   ```suggestion
   ```
   since the comment is already implied by the test



##########
src/parser/mod.rs:
##########
@@ -15188,6 +15137,11 @@ impl<'a> Parser<'a> {
                 let func_name = self.parse_object_name(true)?;
                 let func = self.parse_function(func_name)?;
                 return Ok(Some(TableVersion::Function(func)));
+            } else if dialect_of!(self is DatabricksDialect)

Review Comment:
   I think this should use the defined `supports_timestamp_versioning`?



##########
src/dialect/databricks.rs:
##########
@@ -47,6 +47,11 @@ impl Dialect for DatabricksDialect {
         true
     }
 
+    // 
https://docs.databricks.com/gcp/en/delta/history#delta-time-travel-syntax

Review Comment:
   ```suggestion
       /// 
https://docs.databricks.com/gcp/en/delta/history#delta-time-travel-syntax
   ```



##########
tests/sqlparser_databricks.rs:
##########
@@ -366,3 +366,87 @@ fn data_type_timestamp_ntz() {
         s => panic!("Unexpected statement: {s:?}"),
     }
 }
+
+#[test]
+fn parse_table_time_travel() {
+    let version = "2018-10-18T22:15:12.013Z".to_string();
+    let sql = format!("SELECT 1 FROM t1 TIMESTAMP AS OF '{version}'");
+    let select = databricks().verified_only_select(&sql);

Review Comment:
   for the tests we can use
   ```rust
   let dialect = all_dialecs_where(|d| d.supports_timestamp_versioning());
   ```



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