I don't use ReflectiveSchema. I created RelProtoDataType using
RelDataTypeImpl.*proto *directly.

Is there any documentation where I can find a list of supported types ?



On Fri, Jan 28, 2022 at 6:51 PM Julian Hyde <jhyde.apa...@gmail.com> wrote:

> I guess you’re using ReflectiveSchema. I don’t think we support columns of
> (Java) type Character or char. You should convert relkind to a String and I
> think things will be better.
>
> > On Jan 28, 2022, at 4:44 AM, Dmitry Sysolyatin <dm.sysolya...@gmail.com>
> wrote:
> >
> > I found a way how to make the query work. But I don't understand the
> reason:
> > If `relkind` is JavaType(char) (primitive type) then the query does not
> work
> > If `relkind` is JavaType(java.lang.Character) then the query works.
> >
> >
> > On Fri, Jan 28, 2022 at 12:59 PM Dmitry Sysolyatin <
> dm.sysolya...@gmail.com>
> > wrote:
> >
> >> Hi!
> >>
> >> I am implementing a wrapper over calcite in order to use it like
> Postgres
> >> server. But I have a problem with one of a query that Postgres driver
> sends
> >> to the server.
> >>
> >> The query:
> >> ````
> >> SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, c.relname AS
> >> TABLE_NAME,  CASE n.nspname ~ '^pg_' OR n.nspname = 'information_schema'
> >> WHEN true THEN CASE  WHEN n.nspname = 'pg_catalog' OR n.nspname =
> >> 'information_schema' THEN CASE c.relkind   WHEN 'r' THEN 'SYSTEM TABLE'
> >> WHEN 'v' THEN 'SYSTEM VIEW'   WHEN 'i' THEN 'SYSTEM INDEX'   ELSE NULL
> >> END  WHEN n.nspname = 'pg_toast' THEN CASE c.relkind   WHEN 'r' THEN
> >> 'SYSTEM TOAST TABLE'   WHEN 'i' THEN 'SYSTEM TOAST INDEX'   ELSE NULL
>  END
> >> ELSE CASE c.relkind   WHEN 'r' THEN 'TEMPORARY TABLE'   WHEN 'p' THEN
> >> 'TEMPORARY TABLE'   WHEN 'i' THEN 'TEMPORARY INDEX'   WHEN 'S' THEN
> >> 'TEMPORARY SEQUENCE'   WHEN 'v' THEN 'TEMPORARY VIEW'   ELSE NULL   END
> >> END  WHEN false THEN CASE c.relkind  WHEN 'r' THEN 'TABLE'  WHEN 'p'
> THEN
> >> 'PARTITIONED TABLE'  WHEN 'i' THEN 'INDEX'  WHEN 'S' THEN 'SEQUENCE'
> WHEN
> >> 'v' THEN 'VIEW'  WHEN 'c' THEN 'TYPE'  WHEN 'f' THEN 'FOREIGN TABLE'
> WHEN
> >> 'm' THEN 'MATERIALIZED VIEW'  ELSE NULL  END  ELSE NULL  END  AS
> >> TABLE_TYPE, d.description AS REMARKS,  '' as TYPE_CAT, '' as
> TYPE_SCHEM, ''
> >> as TYPE_NAME, '' AS SELF_REFERENCING_COL_NAME, '' AS REF_GENERATION
> FROM
> >> pg_catalog.pg_namespace n, pg_catalog.pg_class c  LEFT JOIN
> >> pg_catalog.pg_description d ON (c.oid = d.objoid AND d.objsubid = 0)
> LEFT
> >> JOIN pg_catalog.pg_class dc ON (d.classoid=dc.oid AND
> >> dc.relname='pg_class')  LEFT JOIN pg_catalog.pg_namespace dn ON
> >> (dn.oid=dc.relnamespace AND dn.nspname='pg_catalog')  WHERE
> c.relnamespace
> >> = n.oid  ORDER BY TABLE_TYPE,TABLE_SCHEM,TABLE_NAME
> >> ```
> >>
> >> The problem is that calcite can't generate code for WHEN CASE block (The
> >> query works if remove WHEN CASE block).
> >>
> >> ```
> >> Caused by: java.lang.NoSuchMethodException:
> >> org.apache.calcite.runtime.SqlFunctions.toChar(java.lang.Object)
> >> ```
> >>
> >> I wrote down the full exception description inside gist:
> >> https://gist.github.com/dssysolyatin/168c97f6033dd68b96822ce0ab48f84c
> >>
> >> Can someone point me to how to resolve this issue?
> >>
>
>

Reply via email to