1

I'm using Calcite to query from both MySql and Vertica.

When running this query:

statement.executeQuery(
        "SELECT a.name, b.name " +
        "FROM mysqlschema.tableA as a " +
        "INNER JOIN verticaschema.tableB as b ON a.id = b.id " +
        "WHERE a.id = 1 AND b.id = 1 "));

For some reason, I see that Calcite is properly accesing tableA whith the correct predicate but it's doing SELECT * FROM verticaschema.tableB for some reason over the second table.

Is there a way of optimizing it so Calcite will run the predicate b.id=1 over tableB too?

Thanks

1 Answers1

1

Apache Calcite has some limitations:

Current limitations: The JDBC adapter currently only pushes down table scan operations; all other processing (filtering, joins, aggregations and so forth) occurs within Calcite. Our goal is to push down as much processing as possible to the source system, translating syntax, data types and built-in functions as we go. If a Calcite query is based on tables from a single JDBC database, in principle the whole query should go to that database. If tables are from multiple JDBC sources, or a mixture of JDBC and non-JDBC, Calcite will use the most efficient distributed query approach that it can.

You should implement it yourself.

inferno
  • 684
  • 6
  • 21
  • Thank you for you comment. I saw this paragraph in the documentation yet I hoped that in simple queries such as the above, it will work properly. Unfortunately we decided not to continue to develop over Calcite due to the problem in this ticket, a StackOverflowError which we encountered (Opened a ticket https://issues.apache.org/jira/browse/CALCITE-2057) and weird 'Cannot convert java.sql.Timestamp to java.lang.Long' exceptions when filtering dates. This lib looks promising but gives the impression of it's still immature. Thanks again! – user8287675 Dec 06 '17 at 09:49
  • @inferno, you wrote "You should implement it yourself." have any example for jdbc query optimization? – arturgspb Feb 17 '20 at 19:44