iffyio commented on code in PR #1476:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1476#discussion_r1802354851
##########
src/ast/ddl.rs:
##########
@@ -143,6 +145,17 @@ pub enum AlterTableOperation {
partition: Partition,
with_name: Option<Ident>,
},
+ /// `UPDATE <column> = <expression> [, ...] [IN PARTITION partition_id]
WHERE <filter_expr>`
+ /// Note: this is a ClickHouse-specific operation, please refer to
+ ///
[ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/update)
+ UpdateData {
Review Comment:
```suggestion
Update {
```
Thinking we can call it update without the data suffix which doesn't seem to
add significant context?
##########
src/parser/mod.rs:
##########
@@ -7156,6 +7156,25 @@ impl<'a> Parser<'a> {
partition,
with_name,
}
+ } else if dialect_of!(self is ClickHouseDialect|GenericDialect)
Review Comment:
Could you take a look at adding a method to the [dialect
trait](https://github.com/apache/datafusion-sqlparser-rs/blob/main/src/dialect/mod.rs#L63-L72)
for this functionality? Also note that testing wise as a result the test in
moving to [common.rs in this
style](https://github.com/apache/datafusion-sqlparser-rs/blob/main/tests/sqlparser_common.rs#L2781)
##########
tests/sqlparser_clickhouse.rs:
##########
@@ -1422,6 +1422,38 @@ fn parse_create_table_on_commit_and_as_query() {
}
}
+#[test]
+fn parse_update_data() {
+ let sql = "ALTER TABLE t UPDATE col1 = 1, col2 = col3 + col4 WHERE cod4 =
1";
Review Comment:
Can we add a test case with `IN PARTITION`?
--
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]