commit | 8346167252bcb90cd64ced9e3a5c893de28f88ed | [log] [tgz] |
---|---|---|
author | Julian Hyde <jhyde@apache.org> | Tue Aug 03 21:36:20 2021 -0700 |
committer | Julian Hyde <jhyde@apache.org> | Fri Aug 06 14:43:43 2021 -0700 |
tree | 747fa234bd14c3b7d4d23065a41d0c767c7e493b | |
parent | 96cbd709caff1084ca190ec45c76f2092c33a52b [diff] |
[CALCITE-4485] JDBC adapter generates invalid SQL when one of the joins is "INNER JOIN ... ON TRUE" If the join tree is a mixture of cross-joins and outer joins, RelToSqlConverter wrongly generates comma-join syntax. Consider the (pseudo) RelNode tree CrossJoin(a, LeftJoin(b, CrossJoin(c, d))) Before this bug was fixed, RelToSqlConvert would generate FROM a, b LEFT JOIN c, d Because LEFT JOIN has higher precedence than ',', this is parsed to LeftJoin(CrossJoin(a, b), CrossJoin(c, d)) which is incorrect. The fix is to only generate comma-join syntax if all joins are cross-joins. In this case, we will generate (pseudo SQL) FROM a CROSS JOIN b LEFT JOIN c CROSS JOIN d which is safe.
Apache Calcite is a dynamic data management framework.
It contains many of the pieces that comprise a typical database management system but omits the storage primitives. It provides an industry standard SQL parser and validator, a customisable optimizer with pluggable rules and cost functions, logical and physical algebraic operators, various transformation algorithms from SQL to algebra (and the opposite), and many adapters for executing SQL queries over Cassandra, Druid, Elasticsearch, MongoDB, Kafka, and others, with minimal configuration.
For more details, see the home page.