Class QuerySemantics

java.lang.Object
com.axelor.meta.query.QuerySemantics

public final class QuerySemantics extends Object
What a query says about its own results.

The parsed query already records which selections are aggregated and whether it groups, so a consumer never has to infer either from the values that come back. A pivot that knows a column is an average will refuse to average it again; one that has to guess will guess wrong on exactly the data where it matters.

  • Method Details

    • aggregatesByColumn

      public static Map<String,AggregateFn> aggregatesByColumn(Query query)
      The aggregation method behind each result column, for the columns that have one.
    • levelOf

      public static AggregationLevel levelOf(Query query)
      Whether the query returns rows or grouped measures.

      A query is aggregate if it groups or if any selection aggregates. A query that mixes grouped and ungrouped selections is aggregate too: once any row-combining has happened, no record in the result corresponds to a single underlying row, which is the only thing detail promises. Where the two readings differ, this errs toward aggregate, because a consumer that wrongly believes it holds detail rows will re-aggregate them and double-count, while one that wrongly believes it holds measures will decline to and say so.

    • aggregateFn

      public static AggregateFn aggregateFn(String fn)
      The aggregate a query function name stands for, or null for a scalar function or none.