Thanks
I see where to start the adaptor implementation now.

What about iteration ?

The examples I could find always use a Properties and jdbc Connection more or less like this
Properties info = new Properties();
    info.put("model",
        "inline:"
            + "{\n"
            + "  version: '1.0',\n"
            + "   schemas: [\n"
            + "     {\n"
            + "       type: 'custom',\n" .......
            + "   ]\n"
            + "}");
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);

I believe this is the common use case but in our case we already have 'storage' object instances similar to Schema and Table
and we would like to avoid the whole JDBC API.

Is there something more direct, lower-level ?

Johann


On 20/03/2018 15:09, Michael Mior wrote:
Johann,

I'm not sure that documentation is out of date, but it's true that it's not
necessarily the best way to go about writing an adapter. That documentation
should definitely be updated and improved. Currently, your best option
would likely be to look at existing adapters. A minimal adapter
implementation might look like this:

1. A subclass of TableScan which allows scanning all data in a particular
table
2. A subclass of AbstractQueryableTable which implements toRel to return an
instance of your custom TableScan
3. A subclass of Schema which returns table information (including
instances of your custom Table subclass)
4. A subclass of SchemaFactory which implements the create method to return
an instance of your Schema subclass
5. A rule which converts your custom TableScan to an Enumerable

There are a few other bits of plumbing required which looking at the
existing adapters should help you figure out. It might sound a little
overwhelming, but when I first wrote the Cassandra adapter with zero
experience with Calcite it only took a day or two to get something basic
functioning. Feel free to follow up with more questions!

--
Michael Mior
[email protected]

2018-03-20 7:33 GMT-04:00 johann sorel <[email protected]>:

Hello,

A quick presentation since I am new here :
My name is Johann Sorel, I am developer (and PMC) on Apache SIS (
http://sis.apache.org), and on some others GeotoolKit, Examind, GeoAPI,
...etc...
I work mostly on data models and decoder/encoders.


I have a few questions on Adaptors to use the SQL capabilities of Calcite
in Apache SIS.
- Where can we find a up-to-date tutorial or example to execute a basic
SELECT query in Java.
the short code at https://calcite.apache.org/doc
s/howto.html#implementing-an-adapter is obsolete with version 1.16.
and do not show how we loop on the result records.
- The above code use CalcitePrepareImpl which doc says it's for testing
purpose and unstable, is there a stable api somewhere ?

I'm sorry if those are newbie questions but I could not find the answers
in the doc.

Thanks

Johann Sorel



Reply via email to