Java Code Examples for org.apache.calcite.rel.core.AggregateCall#hasFilter()

The following examples show how to use org.apache.calcite.rel.core.AggregateCall#hasFilter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DruidRules.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an array of unique filter references from
 * the given list of {@link org.apache.calcite.rel.core.AggregateCall}
 * */
private Set<Integer> getUniqueFilterRefs(List<AggregateCall> calls) {
  Set<Integer> refs = new HashSet<>();
  for (AggregateCall call : calls) {
    if (call.hasFilter()) {
      refs.add(call.filterArg);
    }
  }
  return refs;
}
 
Example 2
Source File: DruidRules.java    From calcite with Apache License 2.0 5 votes vote down vote up
private static boolean allAggregatesHaveFilters(List<AggregateCall> calls) {
  for (AggregateCall call : calls) {
    if (!call.hasFilter()) {
      return false;
    }
  }
  return true;
}
 
Example 3
Source File: DruidRules.java    From calcite with Apache License 2.0 5 votes vote down vote up
private static List<Integer> getFilterRefs(List<AggregateCall> calls) {
  List<Integer> refs = new ArrayList<>();
  for (AggregateCall call : calls) {
    if (call.hasFilter()) {
      refs.add(call.filterArg);
    }
  }
  return refs;
}
 
Example 4
Source File: AggregateMergeRule.java    From calcite with Apache License 2.0 5 votes vote down vote up
private boolean isAggregateSupported(AggregateCall aggCall) {
  if (aggCall.isDistinct()
      || aggCall.hasFilter()
      || aggCall.isApproximate()
      || aggCall.getArgList().size() > 1) {
    return false;
  }
  SqlSplittableAggFunction splitter = aggCall.getAggregation()
      .unwrap(SqlSplittableAggFunction.class);
  return splitter != null;
}