code: private void validateQuery(Query query) throws IllegalArgumentException {
      if (query.getKindCount() != 1) {
        throw new IllegalArgumentException("Query must have exactly one kind.");
      }
      if (query.getOrderCount() != 0) {
        throw new IllegalArgumentException("Query cannot have any sort orders.");
      }
      if (query.hasFilter()) {
        validateFilter(query.getFilter());
      }
    }
docs: Verifies that the given query can be properly scattered.
  
  @param query the query to verify
  @throws IllegalArgumentException if the query is invalid.