Has anyone implemented a presentation feature in the Apache Calcite adapter?
P粉885035114
2023-09-02 12:15:50
<p>I want to implement a <code>show foo</code> command related to the database engine we wish to connect to Calcite via the Calcite adapter. Of course, <code>foo</code> 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. </p>
<p>My current idea is to create a new "foo" table type with the relevant columns that the command should return, and then map <code>show foo</code> to the equivalent: </p> ;
<pre class="brush:sql;toolbar:false;">select * from foo;
</pre>
<p>Of course, this is done using Calcite relnodes. On the backend, I know what I have to convert it to. </p>
You may want to check out sqlline, which implements commands similar to
show
:!dbinfo
,!tables
,!schemas
etc. If you look at Commands.java you 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 the org.apache.calcite.jdbc namespace.