Ulrich Kramer created CALCITE-6436:
--------------------------------------
Summary: Missing round brackets in WHERE condition which contains
calculations
Key: CALCITE-6436
URL: https://issues.apache.org/jira/browse/CALCITE-6436
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.37.0
Reporter: Ulrich Kramer
Running the following unit test in {{JdbcAdapterTest}} fails with
{code:java}
@Test void testOperatorInWhere() {
CalciteAssert.model(FoodmartSchema.FOODMART_MODEL)
.query("with A as (select (\"product_id\" = 1) AS abc from
\"sales_fact_1997\") "
+ "select * from A "
+ "where abc = ?")
.consumesPreparedStatement(p -> p.setBoolean(1, true))
.runs();
}
{code}
{noformat}
Caused by: java.lang.RuntimeException: While executing SQL [SELECT "product_id"
= 1 AS "ABC"
FROM "foodmart"."sales_fact_1997"
WHERE "product_id" = 1 = ?] on JDBC sub-schema
at
java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)