You are correct. Calcite does not support CREATE TYPE. In fact it doesn't support any DDL. (I'm working on https://issues.apache.org/jira/browse/CALCITE-707, but it's not finished, it will be in an optional module, and it won't support CREATE TYPE at first.)
You can, however, create types programmatically; search for "address" in MockCatalogReader and you will see some examples. Julian On Wed, Nov 8, 2017 at 2:22 PM, Shuyi Chen <[email protected]> wrote: > Ping, any idea? Thanks a lot. > > Shuyi > > On Tue, Nov 7, 2017 at 11:00 AM, Shuyi Chen <[email protected]> wrote: > >> Hi, >> >> I want to use the row value constructor and CAST to create a named row, or >> even nested named row, e.g. >> >> CREATE TYPE myrowtype AS (f1 INTEGER, f2 VARCHAR(10)) >> SELECT CAST(ROW(intField, "test") AS myrowtype) AS myRow FROM myTable; >> >> So if converted to JSON, the output will be {"myRow":{"f0": ${intField}, >> "f1":"test"}}. >> >> I tried it out, the RVC and CAST are working, but seems Calcite doesn't >> support CREATE TYPE in the grammar. Please correct me if I am wrong. >> Thanks a lot. >> >> Shuyi >> >> -- >> "So you have to trust that the dots will somehow connect in your future." >> > > > > -- > "So you have to trust that the dots will somehow connect in your future."
