iffyio commented on code in PR #1984: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1984#discussion_r2244838398
########## src/dialect/mod.rs: ########## @@ -1136,6 +1136,13 @@ pub trait Dialect: Debug + Any { fn supports_notnull_operator(&self) -> bool { false } + + /// Returns true if the dialect supports the `INTERVAL` data type with [Postgres]-style options. Review Comment: Could we add an example expression here? Thinking it would clarify the behavior without having folks consult the pg docs if they don't want to dig deeper into the syntax ########## src/ast/data_type.rs: ########## @@ -346,7 +346,11 @@ pub enum DataType { /// [1]: https://docs.databricks.com/aws/en/sql/language-manual/data-types/timestamp-ntz-type TimestampNtz, /// Interval type. - Interval, + /// + /// Optional [Postgres] field list and precision: `interval [ fields ] [ (p) ]` + /// + /// [Postgres]: https://www.postgresql.org/docs/17/datatype-datetime.html + Interval(Option<IntervalFields>, Option<u64>), Review Comment: Could we use a struct variant to contain the fields? thinking that would be clearer API wise and easier to document in the cases like this one where we have multiple entries e.g. ``` Interval { /// Postgres ... fields: Option<IntervalFields>, /// Postgres ... precision: Option<u64> } ``` ########## src/parser/mod.rs: ########## @@ -10995,6 +11000,85 @@ impl<'a> Parser<'a> { } } + pub fn parse_optional_interval_fields( Review Comment: ```suggestion fn maybe_parse_optional_interval_fields( ``` -- 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