private ArrayList runLDSQueryOnClientUsingFunc(Function func, Set filter, String query) {
    ResultCollector rcollector = null;

    // Filter can not be set as null if withFilter() is called.
    rcollector = FunctionService.onServer(ClientCacheFactory.getAnyInstance())
        .setArguments(new Object[] {query, filter}).execute(func);
    Object result = rcollector.getResult();
    assertTrue(result instanceof ArrayList);

    // Results from multiple nodes.
    ArrayList resultList = (ArrayList) result;
    resultList.trimToSize();
    List queryResults = new ArrayList();

    if (resultList.size() != 0 && resultList.get(0) instanceof ArrayList) {
      for (Object obj : resultList) {
        if (obj != null) {
          queryResults.addAll((ArrayList) obj);
        }
      }
    }

    return (ArrayList) queryResults;
  }
Runs a {@link LocalDataSet} query on a single server.

@return results in a List
geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java