niebayes opened a new issue, #13700:
URL: https://github.com/apache/datafusion/issues/13700

   `SqlToRel` provides two constructors: `new` and `new_with_options`. The 
former uses default `ParserOptions`, while the latter accepts `ParserOptions` 
as an input parameter.
   
   Since `SqlToRel` always requires a `ContextProvider` parameter, and the 
`ContextProvider` trait offers an `ContextProvider::options` interface to 
retrieve `ConfigOptions`, which includes a `SqlParserOptions` with 
functionality equivalent to `ParserOptions`.
   
   I believe we should modify `SqlToRel::new` to derive `ParserOptions` from 
`SqlParserOptions`, rather than relying on the default `ParserOptions`. This 
approach would allow us to consistently use a single set of parser options 
throughout the session's lifetime, rather than setting parser options for each 
query. Doing so would reduce redundancy and the risk of inconsistency, making 
the code less error-prone. (Actually, we have encountered an error due to 
inconsistency between the SessionConfig and the ParserOptions)
   
   Possible implementation:
   ``` rust
   impl From<SqlParserOptions> for ParserOptions { ... }
   
   impl<'a, S: ContextProvider> SqlToRel<'a, S> {
       /// Create a new query planner
       pub fn new(context_provider: &'a S) -> Self {
           let sql_paser_options = context_provider.options().sql_parser;
           Self::new_with_options(context_provider, 
ParserOptions::from(sql_parser_options))
       }
   ```
   


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

Reply via email to