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


##########
src/tokenizer.rs:
##########
@@ -1308,6 +1356,28 @@ impl<'a> Tokenizer<'a> {
                                 _ => self.start_binop(chars, "||", 
Token::StringConcat),
                             }
                         }
+                        Some('&') if dialect_of!(self is PostgreSqlDialect | 
RedshiftSqlDialect) => {

Review Comment:
   similarly for these clauses it would be nice to use the 
`self.dialect.supports_geometric_types()` method



##########
src/ast/data_type.rs:
##########
@@ -879,3 +882,29 @@ pub enum ArrayElemTypeDef {
     /// `Array(Int64)`
     Parenthesis(Box<DataType>),
 }
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

Review Comment:
   Could we add a short description to this struct with a link to the docs?



##########
src/parser/mod.rs:
##########
@@ -3079,6 +3128,55 @@ impl<'a> Parser<'a> {
             Token::QuestionAnd => Some(BinaryOperator::QuestionAnd),
             Token::QuestionPipe => Some(BinaryOperator::QuestionPipe),
             Token::CustomBinaryOperator(s) => 
Some(BinaryOperator::Custom(s.clone())),
+            Token::DoubleSharp if dialect_of!(self is PostgreSqlDialect | 
RedshiftSqlDialect) => {

Review Comment:
   for these clauses as well could we use the introduced 
`self.dialect.supports_geometric_types()`?



##########
src/dialect/mod.rs:
##########
@@ -912,6 +927,10 @@ pub trait Dialect: Debug + Any {
     fn supports_array_typedef_size(&self) -> bool {
         false
     }
+    /// Returns true if the dialect supports geometric types.

Review Comment:
   Could we add a link to the postgres docs here (and maybe an example sql)? it 
would help folks with context on what we mean by geometric types



##########
src/ast/operator.rs:
##########
@@ -53,6 +53,21 @@ pub enum UnaryOperator {
     PGAbs,
     /// Unary logical not operator: e.g. `! false` (Hive-specific)
     BangNot,
+    /// `#` Number of points in path or polygon (PostgreSQL/Redshift geometric 
operator)
+    /// see <https://www.postgresql.org/docs/9.5/functions-geometry.html>
+    NumOfPoints,

Review Comment:
   Can we do similar to the binary operator where we name them according to 
their symbols to be dialect agnostic?



##########
src/ast/data_type.rs:
##########
@@ -386,6 +386,8 @@ pub enum DataType {
     ///
     /// [bigquery]: 
https://cloud.google.com/bigquery/docs/user-defined-functions#templated-sql-udf-parameters
     AnyType,
+    /// geometric type

Review Comment:
   Could we include a link to the postgres docs here?



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