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

Julian Hyde commented on CALCITE-4963:
--------------------------------------

I agree.

In an ideal world {{SqlDialectFactory}} would be a function from 
{{SqlDialect.Context}} to {{SqlDialect}}, and some other code would convert 
{{DatabaseMetaData}} to {{SqlDialect.Context}} before calling the chain of 
factories. But it's too disruptive to change the interface. The cost of having 
each factory in the chain convert {{DatabaseMetaData}} to 
{{SqlDialect.Context}} is not too bad.

Maybe the best place for the static method is a new {{class SqlDialects}}.

Can you rework your PR (add a commit -- don't squash or rebase) so that the 
flow of "SqlDialect create(DatabaseMetaData databaseMetaData)" is more similar 
to today, there is a new class SqlDialects with a static method, and add a test 
case.

> Extensibility of SqlDialectFactory lacks reusability of 
> SqlDialectFactoryImpl.*
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-4963
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4963
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Marco Jorge
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> _(nicetities first - great project and thanks all for the great work)_
> Although it's possible to extend the SqlDialectFactory, the custom 
> implementation cannot reuse any of the behaviour of the default 
> SqlDialectFactoryImpl. The default SqlDialectFactoryImpl has lots of 
> important/reusable behaviour such as #getCasing, #isCaseSensitive, 
> #getNullCollation or even the default decisioning in the #create method.
> If any user needs to provide a custom SqlDialect yet still support the 
> existing SqlDialects the user needs to copy the whole SqlDialectFactoryImpl 
> to make the custom changes.
> This request is to make the default behavior in SqlDialectFactoryImpl 
> reusable so that extensions don't need to fork a whole class.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to