[ 
https://issues.apache.org/jira/browse/CALCITE-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16952457#comment-16952457
 ] 

Danny Chen commented on CALCITE-3416:
-------------------------------------

Well, i think [~swtalbot]'s request is that how to config or fine tweak a 
sub-class SqlDialect, for example, how we can change the unquotedCasing for 
BigQuerySqlDialect, this may be the code for current codes:

{code:java}
SqlDialect dialect = new BigQuerySqlDialect(
          EMPTY_CONTEXT
              .withDatabaseProduct(SqlDialect.DatabaseProduct.BIG_QUERY)
              .withLiteralQuoteString("'")
              .withLiteralEscapedQuoteString("\\'")
              .withIdentifierQuoteString("`")
              .withNullCollation(NullCollation.LOW)
              .withUnquotedCasing(Casing.UPPER_CASE) // what we have changed
              .withQuotedCasing(Casing.UNCHANGED)
              .withCaseSensitive(false));
{code}
It would be nice if we do not copy these redundant codes.

> SQL Dialects "DEFAULT"s should be more extensible
> -------------------------------------------------
>
>                 Key: CALCITE-3416
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3416
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Steven Talbot
>            Priority: Minor
>
> The behavior of SQLDialect is partly governed by the methods defined on the 
> given dialect subclass and partly governed by options passed in in a Context 
> object. So every dialect subclass exposes a "DEFAULT" instance that has been 
> initialized with the correct Context.
> However, if you then wish to extend the dialect for one reason or another, 
> you must create a new instance to extend, or of course create a whole new 
> subclass. In either case, you lose the options from the Context passed into 
> the default, which governs important behavior of the dialect. You can 
> copy-paste the relevant Context out of the Calcite code, but then you lose 
> future improvements or fixes that might land in mainline Calcite.
> It would be nice if each dialect exposed the DEFAULT_CONTEXT that it passed 
> into its DEFAULT instance as a public final member. Then, when extending the 
> dialect, you simply initialize your extension with the DEFAULT_CONTEXT, and 
> if any customization needs to happens on the Context options that's easy to 
> do with the Context's API.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to