private boolean isGroupingKey(Expression node) {
      FieldId fieldId =
          requireNonNull(columnReferences.get(NodeRef.of(node)), () -> "No field for " + node)
              .getFieldId();

      if (orderByScope.isPresent() && isFieldFromScope(fieldId, orderByScope.get())) {
        return true;
      }

      return groupingFields.contains(fieldId);
    }
visitor returns true if all expressions are constant with respect to the group.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AggregationAnalyzer.java