Hi Mark,

It is not easy to understand what is missing from the pieces of code you
shared.

In the example that I've shared with you, I don't remember seeing anywhere
CREATE VIEW statements. I suppose you are trying to execute a
java.sql.Statement but I am afraid this will not work. You don't need to
create the view in Postgres (assuming that is already there) but you just
need to make Calcite aware of it. This will not be done by executing a
Statement but by using various APIs like the one in the test case mentioned
earlier.

I think the easiest way to go would be to modify the test case itself and
see if how it can be adapted based on your schema.

Best,
Stamatis



On Mon, Apr 8, 2019 at 3:29 PM Yuzhao Chen <[email protected]> wrote:

> Or you can config your framework config with a schema implemented by your
> self [1], the getTable should be implemented correctly [2]. Then config the
> CalciteCatalogReader with the schema and schemaPath [3].
> The validator used your CalciteCatalogReader will recognize your tables in
> Postgres.
>
> [1]
> https://github.com/apache/calcite/blob/a8e71f9f295e36e472d9f650d1c76d2501e1fdbf/core/src/main/java/org/apache/calcite/tools/FrameworkConfig.java#L55
> [2]
> https://github.com/apache/calcite/blob/a8e71f9f295e36e472d9f650d1c76d2501e1fdbf/core/src/main/java/org/apache/calcite/schema/Schema.java#L63
> [3]
> https://github.com/apache/calcite/blob/a8e71f9f295e36e472d9f650d1c76d2501e1fdbf/core/src/main/java/org/apache/calcite/prepare/CalciteCatalogReader.java#L100
>
> Best,
> Danny Chan
> 在 2019年4月5日 +0800 PM10:00,Mark Pasterkamp <[email protected]
> >,写道:
> > Dear all,
> >
> > I have connected my postgresql database as a datasource to calcite. I am
> > however not able to find out how I can expose the existing materialized
> > views in postgres to calcite. I am unable to find much help on the
> internet
> > so if anyone is knowledgeable about this I would really appreciate a
> small
> > code example as to how this is supposed to work in Java.
> >
> >
> > Mark
>

Reply via email to