private boolean aggregationCannotUseMergeSort() {
    if (analysis.hasGroupByParameter()) {
      return true;
    }

    for (Expression expression : analysis.getDeviceViewOutputExpressions()) {
      if (expression instanceof FunctionExpression) {
        String functionName = ((FunctionExpression) expression).getFunctionName();
        if (COUNT_IF.equalsIgnoreCase(functionName) || DIFF.equalsIgnoreCase(functionName)) {
          return true;
        }
      }
    }

    return false;
  }
aggregation align by device, and aggregation is `count_if` or `diff`, or aggregation used with
group by parameter (session, variation, count), use the old aggregation logic
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java