I want to implement a show foo
command related to the database engine we wish to connect to Calcite via the Calcite adapter. Of course, foo
is something specific to that database engine. I'm trying to figure out which relnode it should be mapped to (among other details). So if anyone has implemented the "show" statement as a Calcite adapter and has some tips for me, it would be greatly appreciated.
My current idea is to create a new "foo" table type with the relevant columns that the command should return, and then map show foo
to the equivalent:
select * from foo;
Of course, this is done using Calcite relnodes. On the backend, I know what I have to convert it to.
You may want to check outsqlline, which implements commands similar to
show
:!dbinfo
,!tables
,!schemas
etc. If you look atCommands.javayou will see that they are implemented via JDBC.From there, however, you can get to know the Calcite side of things in the various classes in theorg.apache.calcite.jdbcnamespace.