[
https://issues.apache.org/jira/browse/CALCITE-1769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16003818#comment-16003818
]
slim bouguerra commented on CALCITE-1769:
-----------------------------------------
[~julianhyde]
tried to run the integration test with the {code}sql("?").withRel{code} and
seems like it is getting folded by org.apache.calcite.jdbc.CalcitePrepare.Query
before getting to the druid rules.
For instance test like
{code}
@Test public void testPushNumericCastOverLiteral() {
sql("?")
.withRel(new Function<RelBuilder, RelNode>() {
public RelNode apply(RelBuilder b) {
// select count(*) as c
// from foodmart.foodmart
// where product_id = 'id'
final RelDataType doubleType =
b.getTypeFactory().createSqlType(SqlTypeName.DOUBLE);
return b.scan("foodmart", "foodmart")
.filter(
b.call(SqlStdOperatorTable.EQUALS, b.field("product_id"),
b.getRexBuilder()
.makeCall(doubleType, SqlStdOperatorTable.CAST,
ImmutableList.<RexNode>of(b
.literal("5")))))
.aggregate(b.groupKey(), b.countStar("c"))
.build();
}
})
.returnsUnordered("c=44")
.queryContains(druidChecker("'queryType':'timeseriesz'"));
}
{code}
passes with or without my patch.
> Push Filters down to druid when there a cast to numeric
> -------------------------------------------------------
>
> Key: CALCITE-1769
> URL: https://issues.apache.org/jira/browse/CALCITE-1769
> Project: Calcite
> Issue Type: Bug
> Components: druid
> Reporter: slim bouguerra
> Assignee: Julian Hyde
> Fix For: 1.13.0
>
>
> Currently if we have cast to numeric over literal filter will not get pushed.
> For instance query like {code}SELECT page from druid_table_1 WHERE page < 5
> group by page {code} from hive will introduce a cast over `5`.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)