andygrove commented on a change in pull request #7916:
URL: https://github.com/apache/arrow/pull/7916#discussion_r469307058



##########
File path: rust/datafusion/src/sql/parser.rs
##########
@@ -77,20 +77,20 @@ pub struct DFParser {
 
 impl DFParser {
     /// Parse the specified tokens
-    pub fn new(sql: &str) -> Result<Self, ParserError> {
-        let dialect = GenericDialect {};
-        let mut tokenizer = Tokenizer::new(&dialect, sql);
+    pub fn new(sql: &str, dialect: &dyn Dialect) -> Result<Self, ParserError> {
+        let mut tokenizer = Tokenizer::new(dialect, sql);
         let tokens = tokenizer.tokenize()?;
         Ok(DFParser {
             parser: Parser::new(tokens),
         })
     }
 
     /// Parse a SQL statement and produce a set of statements
-    pub fn parse_sql(sql: &str) -> Result<Vec<Statement>, ParserError> {
-        let mut tokenizer = Tokenizer::new(&GenericDialect {}, &sql);
-        tokenizer.tokenize()?;
-        let mut parser = DFParser::new(sql)?;
+    pub fn parse_sql(
+        sql: &str,
+        dialect: &dyn Dialect,

Review comment:
       Perhaps we should store the dialect in the DFParser struct so we don't 
have to pass it in here as well?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to