CacheSerializableRunnable getCacheSerializableRunnableForPRCountStarQueries(
      final String regionName, final String localRegion) {
    SerializableRunnable PrRegion = new CacheSerializableRunnable("PRCountStarQuery") {
      @Override
      public void run2() throws CacheException {

        Cache cache = getCache();
        // Querying the localRegion and the PR region

        String[] queries = new String[] {"select COUNT(*) from " + SEPARATOR + regionName,
            "select COUNT(*) from " + SEPARATOR + regionName + " where ID > 0",
            "select COUNT(*) from " + SEPARATOR + regionName + " where ID > 0 AND status='active'",
            "select COUNT(*) from " + SEPARATOR + regionName + " where ID > 0 OR status='active'",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " where ID > 0 AND status LIKE 'act%'",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " where ID > 0 OR status LIKE 'ina%'",
            "select COUNT(*) from " + SEPARATOR + regionName + " where ID IN SET(1, 2, 3, 4, 5)",
            "select COUNT(*) from " + SEPARATOR + regionName + " where NOT (ID > 5)",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName + " where ID > 0",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " where ID > 0 AND status='active'",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " where ID > 0 OR status='active'",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " where ID > 0 AND status LIKE 'act%'",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " where ID > 0 OR status LIKE 'ina%'",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " where ID IN SET(1, 2, 3, 4, 5)",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName + " where NOT (ID > 5)",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 AND pos.secId = 'IBM'",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 AND pos.secId = 'IBM'",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 AND pos.secId = 'IBM' LIMIT 5",
            "select DISTINCT COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 AND pos.secId = 'IBM' ORDER BY p.ID",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 AND p.status = 'active' AND pos.secId = 'IBM'",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 AND p.status = 'active' OR pos.secId = 'IBM'",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 OR p.status = 'active' OR pos.secId = 'IBM'",
            "select COUNT(*) from " + SEPARATOR + regionName
                + " p, p.positions.values pos where p.ID > 0 OR p.status = 'active' OR pos.secId = 'IBM' LIMIT 150",
            // "select DISTINCT COUNT(*) from /" + regionName + " p, p.positions.values pos where
            // p.ID > 0 OR p.status = 'active' OR pos.secId = 'IBM' ORDER BY p.ID",
        };

        Object[][] r = new Object[queries.length][2];
        Region region = cache.getRegion(regionName);
        assertNotNull(region);

        final String[] expectedExceptions =
            new String[] {RegionDestroyedException.class.getName(), ReplyException.class.getName(),
                CacheClosedException.class.getName(), ForceReattemptException.class.getName(),
                QueryInvocationTargetException.class.getName()};

        for (final String expectedException : expectedExceptions) {
          getCache().getLogger()
              .info("<ExpectedException action=add>" + expectedException + "</ExpectedException>");
        }

        QueryService qs = getCache().getQueryService();
        Object[] params;

        try {
          for (int j = 0; j < queries.length; j++) {
            synchronized (region) {
              // Execute on PR region.
              String qStr = queries[j];
              SelectResults sr = (SelectResults) qs.newQuery(qStr).execute();
              r[j][0] = sr;

              // Execute on local region.
              qStr = queries[j];
              SelectResults srr =
                  (SelectResults) qs.newQuery(qStr.replace(regionName, localRegion)).execute();
              r[j][1] = srr;
            }
          }
          LogWriterUtils.getLogWriter().info(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRQueryAndCompareResults: Queries Executed successfully on Local region & PR Region");

          StructSetOrResultsSet ssORrs = new StructSetOrResultsSet();
          ssORrs.CompareCountStarQueryResultsWithoutAndWithIndexes(r, queries.length, true,
              queries);

        } catch (QueryInvocationTargetException e) {
          // throw an unchecked exception so the controller can examine the cause and see whether or
          // not it's okay
          throw new TestException(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRQueryAndCompareResults: Caught unexpected query exception",
              e);
        }

        catch (QueryException e) {
          LogWriterUtils.getLogWriter().error(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRQueryAndCompareResults: Caught QueryException while querying"
                  + e,
              e);
          throw new TestException(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRQueryAndCompareResults: Caught unexpected query exception",
              e);
        }

        catch (RegionDestroyedException rde) {
          LogWriterUtils.getLogWriter().info(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRQueryAndCompareResults: Caught a RegionDestroyedException while querying as expected ",
              rde);

        } catch (CancelException cce) {
          LogWriterUtils.getLogWriter().info(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRQueryAndCompareResults: Caught a CancelException while querying as expected ",
              cce);

        } finally {
          for (final String expectedException : expectedExceptions) {
            getCache().getLogger().info(
                "<ExpectedException action=remove>" + expectedException + "</ExpectedException>");
          }
        }

      }

    };
    return (CacheSerializableRunnable) PrRegion;
  }
This function <br>
1. Creates & executes a query with Logical Operators on the given PR Region 2. Executes the
same query on the local region <br>
3. Compares the appropriate resultSet <br>
geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java