cocofhu created CALCITE-5589:
--------------------------------

             Summary: ElasticsearchFilterRule cannot filter aggregate query
                 Key: CALCITE-5589
                 URL: https://issues.apache.org/jira/browse/CALCITE-5589
             Project: Calcite
          Issue Type: Bug
          Components: elasticsearch-adapter
            Reporter: cocofhu


This code converts all filters, but does not handle conditions with aggregation 
operations
{code:java}
//代码占位符
private static final ElasticsearchFilterRule INSTANCE = Config.INSTANCE
        .withConversion(LogicalFilter.class, Convention.NONE,
                ElasticsearchRel.CONVENTION, "ElasticsearchFilterRule")
        .withRuleFactory(ElasticsearchFilterRule::new)
        .toRule(ElasticsearchFilterRule.class); {code}
for example: select * from(select sum(_MAP['cnt']) as cnt, id from establexxx 
where id > 3 ) where cnt > 300,this value is greater than 300 and cannot be 
converted normally.
 
Maybe it can be solved through such modification:
{code:java}
private static final ElasticsearchFilterRule INSTANCE = Config.INSTANCE
        .withInTrait(Convention.NONE)
        .withOutTrait(ElasticsearchRel.CONVENTION)
        .withOperandSupplier(b0 -> 
b0.operand(LogicalFilter.class).oneInput(b1->b1.operand(ElasticsearchTableScan.class).anyInputs()))
        .as(Config.class)
        .withRuleFactory(ElasticsearchFilterRule::new)
        .toRule(ElasticsearchFilterRule.class); {code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to