dimensions metrics aggregations

Hello, all.

I’m build analytics for mail flow with dimensions [from, to] and metric [size]. As example, I need analytics for flow from:example.com and to:example.com, In this situation I can build such query:

String domain = “example.com”;

GroupByQuery query = GroupByQuery.builder()

                       .setDataSource("test")

                       .setQuerySegmentSpec(QuerySegmentSpecs.create(new Interval(filter.getStart().getMillis(), filter.getEnd().getMillis())))

                       .setGranularity(QueryGranularity.ALL)

                       .addDimension("from")

                       .addDimension("to")

                       .addAggregator(new LongSumAggregatorFactory("size", "size"))

                       .setDimFilter(DimFilters.or(DimFilters.dimEquals("from", domain), DimFilters.dimEquals("to", domain)))

                       .build();

``

Is it possible to query to make aggregation from:“any domain” to:“example.com” and from:“example.com” to:“any domain”, other word I need aggregation all size’s that are sent by “example.com” and received by “example.com” as one line domain:example.com size:some_sum_size

Regards,

Valentin.

Hi Valentin, what is the SQL query you are trying to make?

You may want to check out https://github.com/implydata/plyql if you want to use SQL to reason about your queries.

Fangjin, hello.

Thank for answer. I didn’t use plyql, as I’m need API query generation. But, what I did to wrap such things (merged analytics from 2 dimensions) I just add other dimension that is a merge of dimension to the 3d one, so I execute only one dimension.

Regards,

Valentin.