slim bouguerra created CALCITE-2098:
---------------------------------------
Summary: Push filters to Druid Query Scan when we have OR of AND
clauses
Key: CALCITE-2098
URL: https://issues.apache.org/jira/browse/CALCITE-2098
Project: Calcite
Issue Type: Bug
Reporter: slim bouguerra
Assignee: slim bouguerra
Fix For: 1.16.0
Currently Druid Filter Rule doesn't push filters like {code} OR(AND(F1,F2),
F3){code}
This is due to optimization logic
{code}org.apache.calcite.adapter.druid.DruidRules.DruidFilterRule.splitFilters{code}
Here is an test example:
{code}
/**
* @TODO Fix this case, Druid can handel this kind of expression but the way
* org.apache.calcite.adapter.druid.DruidRules.DruidFilterRule.splitFilters
* works doesn't accept this filter
*/
@Ignore
@Test public void testFilterClauseWithMetric2() {
String sql = "select sum(\"store_sales\")"
+ "from \"foodmart\" where \"product_id\" > 1555 or \"store_cost\" > 5
or extract(year "
+ "from \"timestamp\") = 1997 "
+ "group by floor(\"timestamp\" to DAY),\"product_id\"";
sql(sql)
.queryContains(druidChecker("\"queryType\":\"groupBy\"",
"{\"type\":\"bound\","
+
"\"dimension\":\"store_cost\",\"lower\":\"5\",\"lowerStrict\":true,"
+ "\"ordering\":\"numeric\"}"))
.returnsUnordered("to be computed");
}
{code}
FYI in this example {code} extract(year from \"timestamp\") = 1997{code} will
be transformed to {code}(year >= 1996) AND(year <= 1997){code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)