bombsimon commented on code in PR #1628:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1628#discussion_r1905449986


##########
src/ast/query.rs:
##########
@@ -2465,14 +2465,25 @@ impl fmt::Display for GroupByExpr {
 #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
 #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
 pub enum FormatClause {
-    Identifier(Ident),
+    Identifier {
+        ident: Ident,
+        expr: Option<Vec<Expr>>,
+    },
     Null,
 }

Review Comment:
   My thinking here was that they're referred to as the same in the ClickHouse 
docs which is the only one that uses them so it would make sense to represent 
it the same way in the ast. 
   
   - 
[`FORMAT`](https://clickhouse.com/docs/en/sql-reference/statements/select/format)
 only has one documentation page referring to both use cases.
   - [The interface](https://clickhouse.com/docs/en/interfaces/formats) 
references both of them:
     > ClickHouse can accept and return data in various formats. A format 
supported for input can be used to parse the data provided to `INSERT`s, to 
perform `SELECT`s from a file-backed table such as File, URL or HDFS, or to 
read a dictionary. A format supported for output can be used to arrange the 
results of a `SELECT`, and to perform `INSERT`s into a file-backed table. All 
format names are case insensitive.
   
   So to me re-using the same ast type with an optinal expression for potential 
insert data still makes sense.
   
   Also double checking if you still don't agree with this, I guess you mean 
that the new type should be called `InputFormatClause` since it's the input 
that holds values and not the output, right?



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to