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

Liya Fan commented on CALCITE-4191:
-----------------------------------

[~julianhyde] Thanks for your kind reminder. Sorry I forgot to open a JIRA when 
starting the work. I need to be mindful next time. 

IMHO, RelBuildre solves the problem only when it is applicable. For other 
scenarios, we have to fall back on the {{AggregateCall#create}} methods. For 
example, all the public APIs of RelBuilder (that are not not deprecated) for 
AggregateCall can only be applied when distinct = false, approximate = false 
and ignoreNull = false. 

> Improve the logic of creating aggregate calls
> ---------------------------------------------
>
>                 Key: CALCITE-4191
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4191
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Liya Fan
>            Assignee: Liya Fan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> According to the current code base, the only way to create \{{AggregateCall}} 
> objects is by calling one of the two \{{AggregateCall#create}} methods (other 
> create methods are deprecated).
> The two {{create}} methods have 9 and 11 parameters, respectively, 3 of which 
> are booleans and 2 are ints. We find this makes the code less readable and 
> error-prone, as some bugs are caused by specifying the wrong parameters. 
> In this issue, we improve the related logic by the builder pattern, which 
> results in the following benefits:
> 1. By creating the objects by the builder pattern, there is no need to 
> maintain multiple overrides of the {{create}} methods.
> 2. There is no need to maintain multiple overrides of the {{copy}} methods, 
> either.
> 3. The code becomes more readable and less error-prone, as it is less like to 
> specify the wrong parameter.
> 4. Creating {{AggregateCall}} objects becomes easier, as the user does not 
> have specify the default parameters repeatedly. 



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

Reply via email to