1

I created a region(key: [id, date]) with a PartitionResolver based on date, which means the region is bucketed/partitioned by date. now in function implementation, I want to filter certain date partitions so that I don't have to loop over Map<IdDate, Entity> regionData to filter data for particular dates. The idea is to filter date partitions by straightaway discarding irrelevant buckets which makes the filtering faster. I found that there is an option to use @Filter annotation in functions, but this seems to expect a set of keys. But I would like to provide a set of partition keys (dates in my use case).

Is this possible in spring geode?

veenatic
  • 33
  • 1
  • 1
  • 5

1 Answers1

0

The PartitionedRegionHelper.getHashKey() method is internally used to map the bucketId to an specific key within a partitioned region. When executing a data dependant Function on a PartitionRegion (FunctionService.onRegion().withFilter()), the executor internally retrieves the list of buckets and members using the afore mentioned method.

Considering that spring-data-geode ends up using the withFilter() method when configuring the function through the @Filter annotation, and assuming that the custom implementation for your PartitionResolver.getRoutingObject() method returns the Date part of the key, it should be possible to achieve what you want by just using some dummy data for the id. Have you tried it?.

I might be wrong as I haven't tested this myself (will try to write a small scenario), but it should work.

Cheers.

Juan Ramos
  • 1,421
  • 1
  • 8
  • 13