calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <>
Subject Re: Customizable Return Types for Functions
Date Mon, 14 Dec 2015 23:58:27 GMT
We made a special case for SUM because it is so commonly used, and it would cause confusion
if there were two SUM operators. But I do not see us taking the same approach for other operators.

Calcite allows you to provide your own set of operators and functions in a SqlOperatorTable.
The default operator table contains the SQL standard functions, but you can create your own
operator table, and chain them together so that you see the union of all operators.

If you don’t like the return type of a particular function you can define a new operator
table that re-defines (or eclipses) the function.


> On Dec 14, 2015, at 3:15 PM, Sudheesh Katkam <> wrote:
> Hello developers,
> CALCITE-845 <> allows to
> add a customizable policy to define the return type of the SUM function.
> The SQL standard also allows for the return types of COUNT, AVG, and
> EXTRACT functions (and maybe others) to be implementation-defined. The
> standard only specifies the return type's SqlTypeFamily (EXACT NUMERIC in
> this case).
> How should Calcite allow for customizable return types for functions in
> general? Like SUM's policy, should there be more deriveXXXType() methods in
> the RelDataTypeSystem class?
> Thank you,
> Sudheesh

View raw message