Source:
<code>private void validateHavingClause(FilterExpression havingClause) { if (havingClause instanceof FilterPredicate) { Path path = ((FilterPredicate) havingClause).getPath(); Path.PathElement last = path.lastElement().get(); Class<?> cls = last.getType(); String fieldName = last.getFieldName(); if (cls != queriedTable.getCls()) { throw new InvalidOperationException( String.format( <START> "Classes don't match when try filtering on %s in having clause of %s.", <END> cls.getSimpleName(), queriedTable.getCls().getSimpleName())); } if (queriedTable.isMetric(fieldName)) { if (metrics.stream().noneMatch(m -> m.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Metric field %s must be aggregated before filtering in having clause.", fieldName)); } } else { if (dimensionProjections.stream().noneMatch(dim -> dim.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Dimension field %s must be grouped before filtering in having clause.", fieldName)); } } } else if (havingClause instanceof AndFilterExpression) { validateHavingClause(((AndFilterExpression) havingClause).getLeft()); validateHavingClause(((AndFilterExpression) havingClause).getRight()); } else if (havingClause instanceof OrFilterExpression) { validateHavingClause(((OrFilterExpression) havingClause).getLeft()); validateHavingClause(((OrFilterExpression) havingClause).getRight()); } else if (havingClause instanceof NotFilterExpression) { validateHavingClause(((NotFilterExpression) havingClause).getNegated()); } }</code><technical_language>I try errors friendly a client of Elide - remove "classes". rephrase in terms of is wrong API request</technical_language>

Target:
private void validateHavingClause(FilterExpression havingClause) { if (havingClause instanceof FilterPredicate) { Path path = ((FilterPredicate) havingClause).getPath(); Path.PathElement last = path.lastElement().get(); Class<?> cls = last.getType(); String fieldName = last.getFieldName(); if (cls != queriedTable.getCls()) { throw new InvalidOperationException( String.format( "Can't filter on relationship field %s in HAVING clause when querying table %s.", path.toString(), queriedTable.getCls().getSimpleName())); } if (queriedTable.isMetric(fieldName)) { if (metrics.stream().noneMatch(m -> m.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Metric field %s must be aggregated before filtering in having clause.", fieldName)); } } else { if (dimensionProjections.stream().noneMatch(dim -> dim.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Dimension field %s must be grouped before filtering in having clause.", fieldName)); } } } else if (havingClause instanceof AndFilterExpression) { validateHavingClause(((AndFilterExpression) havingClause).getLeft()); validateHavingClause(((AndFilterExpression) havingClause).getRight()); } else if (havingClause instanceof OrFilterExpression) { validateHavingClause(((OrFilterExpression) havingClause).getLeft()); validateHavingClause(((OrFilterExpression) havingClause).getRight()); } else if (havingClause instanceof NotFilterExpression) { validateHavingClause(((NotFilterExpression) havingClause).getNegated()); } }