[
https://issues.apache.org/jira/browse/CALCITE-629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14368692#comment-14368692
]
Vladimir Sitnikov commented on CALCITE-629:
-------------------------------------------
Regarding Dirver.createPrepareFactory, it looks like an anti-pattern:
{code:java}
public Driver() {
super();
this.prepareFactory = createPrepareFactory();
}
protected Function0<CalcitePrepare> createPrepareFactory() {
return CalcitePrepare.DEFAULT_FACTORY;
}{code}
Calling non-final methods in a constructor is a code smell. The object is not
fully constructed, thus it might be unsafe to call random methods.
It might be an off-topic, however it might be good to accomodate when fixing
current issue.
> Can't use extended version of CalcitePrepareImpl with JDBC Driver
> -----------------------------------------------------------------
>
> Key: CALCITE-629
> URL: https://issues.apache.org/jira/browse/CALCITE-629
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.0.0-incubating
> Reporter: Eugene Zimichev
> Assignee: Julian Hyde
>
> Constructor of CalciteConnectionImpl directly uses field
> Driver#prepareFactory, although Driver class provides protected method that
> can redefine it.
> Because of field hiding user can't register a custom extension of
> CalciteConnectionImpl.
> Proposed fix - use createPrepareFactory method instead of field access.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)