hypertrace / document-store

Document store abstraction that we use across Hypertrace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supporting aggregation w/o even if group by missing

kotharironak opened this issue · comments

Issue

As part of this - #82, we have provided support for new generic query API support for postgres.

Now, we have two different implemenation of this API

  • one for MongoDb
  • one for Postgres

As the query API is generic, there are some differences in how the underlying store handles them.
E.g In the below query : we are applying aggregation w/o group by clasue

org.hypertrace.core.documentstore.query.Query query =
        org.hypertrace.core.documentstore.query.Query.builder()
            .addSelection(
                AggregateExpression.of(DISTINCT_COUNT, IdentifierExpression.of("quantity")),
                "qty_count")
            .addSelection(IdentifierExpression.of("item"))
            .addSelection(IdentifierExpression.of("price"))
            .setFilter(
                LogicalExpression.builder()
                    .operator(AND)
                    .operand(
                        RelationalExpression.of(
                            IdentifierExpression.of("price"), LTE, ConstantExpression.of(10)))
                    .operand(
                        RelationalExpression.of(
                            IdentifierExpression.of("item"),
                            IN,
                            ConstantExpression.ofStrings(
                                List.of("Mirror", "Comb", "Shampoo", "Bottle"))))
                    .build())
            .build();

The above is supported in mongo impl, but not in postgres. As part of this ticket, can we add support for the same in postgres?