Github user jhuynh1 commented on a diff in the pull request:

    https://github.com/apache/geode/pull/318#discussion_r92677783
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryDUnitTest.java
 ---
    @@ -149,6 +154,92 @@ public void run() {
         });
       }
     
    +  @Test
    +  public void testIndexDoesNotDeserializePdxObjects() {
    +    Host host = Host.getHost(0);
    +    VM vm0 = host.getVM(0);
    +    VM vm1 = host.getVM(1);
    +
    +    SerializableRunnableIF createPR = () -> {
    +      Cache cache = getCache();
    +      PartitionAttributesFactory paf = new PartitionAttributesFactory();
    +      paf.setTotalNumBuckets(10);
    +      
cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create())
    +          .create("region");
    +    };
    +    vm0.invoke(createPR);
    +    vm1.invoke(createPR);
    +
    +    // Do Puts. These objects can't be deserialized because they throw
    +    // and exception from the constructor
    +    vm0.invoke(() -> {
    +      Cache cache = getCache();
    +      Region region = cache.getRegion("region");
    +      region.put(0, new PdxNotDeserializableAsset(0, "B"));
    +      region.put(10, new PdxNotDeserializableAsset(1, "B"));
    +      region.put(1, new PdxNotDeserializableAsset(1, "B"));
    +      IntStream.range(11, 100)
    +          .forEach(i -> region.put(i, new PdxNotDeserializableAsset(i, 
Integer.toString(i))));
    +    });
    +
    +    // If this tries to deserialize the assets, it will fail
    +    vm0.invoke(() -> {
    +      Cache cache = getCache();
    +      cache.getQueryService().createHashIndex("ContractDocumentIndex", 
"document", "/region");
    --- End diff --
    
    Would you be able to test out a range index (not a compact range index or 
hash)
    This would require the index expression to contain multiple iterators such 
as /region r, r.someCollection p (assuming the values in the region have 
someCollection populated)   The indexed expression itself could stay the same 
but it would try to create tuples.  In this case, I would think that we would 
have to deserialize the value based on how that index maintains it's keys... 
Just wanted to make sure that index worked correctly (the test would obviously 
throw an error, but I just wanted to make sure that index still gets created 
correctly...)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to