@Override
      public void run2() throws CacheException {
        QueryService remoteQueryService = null;
        QueryService localQueryService = null;
        SelectResults[][] rs = new SelectResults[1][2];
        try {
          remoteQueryService = (PoolManager.find(poolName)).getQueryService();
          localQueryService = getCache().getQueryService();
        } catch (Exception e) {
          Assert.fail("Failed to get QueryService.", e);
        }

        for (final String s : queries) {
          try {
            logger.info("### Executing Query on server:" + s);
            Query query = remoteQueryService.newQuery(s);
            rs[0][0] = (SelectResults) query.execute();

            logger.info("### Executing Query locally:" + s);
            query = localQueryService.newQuery(s);
            rs[0][1] = (SelectResults) query.execute();

            // Compare local and remote query results.
            if (!CacheUtils.compareResultsOfWithAndWithoutIndex(rs)) {
              fail("Local and Remote Query Results are not matching for query :" + s);
            }

          } catch (Exception e) {
            Assert.fail("Failed executing " + s, e);
          }

        }
      }
Tests client-server query with nested and collection of Pdx.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/PdxQueryDUnitTest.java