@Override
      public void run2() throws CacheException {
        Set filter = new HashSet();
        filter.add(0);
        String query = "select * from " + SEPARATOR + " " + repRegionName + " where ID>=0";
        TestServerQueryFunction func = new TestServerQueryFunction("LDS Server function-1");
        function = new TestQueryFunction("queryFunction-1");
        QueryUsingFunctionContextDUnitTest test = new QueryUsingFunctionContextDUnitTest();
        try {
          test.runQueryOnClientUsingFunc(function, repRegionName, filter, query);
          fail("Query execution should have failed.");
        } catch (FunctionException ex) {
          assertTrue("The exception message should mention QueryInvalidException. ",
              ex.getLocalizedMessage().contains("QueryInvalidException"));
        }

        query = "select * from " + SEPARATOR + " " + PartitionedRegionName1 + " where ID>=0";
        func = new TestServerQueryFunction("LDS Server function-1");
        function = new TestQueryFunction("queryFunction-1");
        test = new QueryUsingFunctionContextDUnitTest();
        try {
          test.runQueryOnClientUsingFunc(function, PartitionedRegionName1, filter, query);
          fail("Query execution should have failed.");
        } catch (FunctionException ex) {
          assertTrue("The exception message should mention QueryInvalidException. ",
              ex.getLocalizedMessage().contains("QueryInvalidException"));
        }
      }
Test on PR on one server only using filter.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java