protected ArrayList runQueryOnServerLDS(String queryStr, Set filter) {

    Set buckets = getBucketsForFilter(filter);
    Region localDataSet = new LocalDataSet(
        (PartitionedRegion) CacheFactory.getAnyInstance().getRegion(PartitionedRegionName1),
        buckets);

    QueryService qservice = CacheFactory.getAnyInstance().getQueryService();

    Query query = qservice.newQuery(queryStr);
    final ExecutionContext executionContext =
        new QueryExecutionContext(null, (InternalCache) cache, query);

    SelectResults results;
    try {
      results = (SelectResults) ((LocalDataSet) localDataSet).executeQuery((DefaultQuery) query,
          executionContext,
          null, buckets);

      return (ArrayList) results.asList();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
Run query on server using LocalDataSet.executeQuery() to compare results received from client
function execution.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java