Home  >  Q&A  >  body text

Has anyone implemented a presentation feature in the Apache Calcite adapter?

<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>
P粉885035114P粉885035114414 days ago447

reply all(1)I'll reply

  • P粉668113768

    P粉6681137682023-09-03 11:02:36

    You may want to check out sqlline, which implements commands similar to show: !dbinfo, !tables, !schemasetc. 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.

    reply
    0
  • Cancelreply