You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Ian Bertolacci <ia...@workday.com.INVALID> on 2022/01/04 20:06:05 UTC

Adding a custom SQL type?

Howdy,
How difficult would it be for a Calcite user to add their own type to the type system?
Is there a define process for doing this?

In our system, a relationship is a semantic type which is physically a long integer.
We’ve been able to get by with typing relaltionship fields as SqlTypeName.BIGINT, but it requires a lot of gymnastics, including our own type analysis, inference, and propagation systems.
Recently we’ve hit an issue which would require some substantial changes to this extra type system, which exists solely to compensate for the lack of this specific type in Calcite.

For us, the ideal solution is to add this type, which would be *an* integer type, in Calcite, and let the Calcite type system handle everything.
Is this feasible?

Thanks!
-Ian J. Bertolacci

Re: Adding a custom SQL type?

Posted by Julian Hyde <jh...@gmail.com>.
In Eigenbase, the system from which Calcite evolved, there was support for SQL standard ‘CREATE TYPE’. (See Eigenbase documentation, [1]). I think this is what you want.

That code has atrophied over the years, but some of it still remains in Calcite. If someone wants to put in the effort, it could be revived.

Julian

[1] http://farrago.sourceforge.net/design/UserDefinedTypesAndRoutines.html

> On Jan 4, 2022, at 12:06 PM, Ian Bertolacci <ia...@workday.com.INVALID> wrote:
> 
> Howdy,
> How difficult would it be for a Calcite user to add their own type to the type system?
> Is there a define process for doing this?
> 
> In our system, a relationship is a semantic type which is physically a long integer.
> We’ve been able to get by with typing relaltionship fields as SqlTypeName.BIGINT, but it requires a lot of gymnastics, including our own type analysis, inference, and propagation systems.
> Recently we’ve hit an issue which would require some substantial changes to this extra type system, which exists solely to compensate for the lack of this specific type in Calcite.
> 
> For us, the ideal solution is to add this type, which would be *an* integer type, in Calcite, and let the Calcite type system handle everything.
> Is this feasible?
> 
> Thanks!
> -Ian J. Bertolacci