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

Julian Hyde commented on CALCITE-5545:
--------------------------------------

[~oliverlee], I reviewed the PR. We can't change {{Function0}} to {{Supplier}} 
for public/protected methods/fields, so I reverted that. I had to find a way 
for the 3 ways to customize to co-exist:
 * calling the {{withPrepareFactory}} method to create a new Driver instance;
 * overriding the createPrepareFactory method in a subclass(now deprecated, but 
they are still allowed to override, and therefore we still have to call it, to 
find out whether it has been overridden);
 * overriding the new {{createPrepare}} method in a subclass.

The best solution is to keep the {{prepareFactory}} method, but make it 
nullable, and if it's null call the old {{createPrepareFactory}} method. I 
added a commit the above changes, and tests for all of the combinations. Please 
review the commit I appended to your commits in 
[julianhyde/5545-pluggable-validator|https://github.com/julianhyde/calcite/tree/5545-pluggable-validator].

> Allow for overriding SqlValidator to enable custom SqlNode validation
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-5545
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5545
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Oliver Lee
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> Goal: Be able to enable custom SqlNode validation
> It will require overloading {{CalcitePrepareImpl}}, setting the 
> {{prepareFactory}} in {{Driver.java}} to use the overloaded 
> {{CalcitePrepareImpl}}, and then overloading {{createSqlValidator()}} and 
> {{getSqlValidator()}} of {{CalcitePreparingStmt}}
> Some changes to constructor access level is needed, no functionality or logic 
> change is needed 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to