|
29 | 29 | import grpc
|
30 | 30 | from pymitter import EventEmitter
|
31 | 31 |
|
32 |
| -from coherence.aggregator import EntryAggregator |
| 32 | +from coherence.aggregator import EntryAggregator, SumAggregator, AverageAggregator, PriorityAggregator |
33 | 33 |
|
34 | 34 | from .comparator import Comparator
|
35 | 35 | from .event import MapLifecycleEvent, MapListener, SessionLifecycleEvent
|
@@ -648,6 +648,19 @@ async def aggregate(
|
648 | 648 | r = self._request_factory.aggregate_request(aggregator, keys, filter)
|
649 | 649 | results = await self._client_stub.aggregate(r)
|
650 | 650 | value: Any = self._request_factory.get_serializer().deserialize(results.value)
|
| 651 | + # for compatibility with 22.06 |
| 652 | + if isinstance(aggregator, SumAggregator) and isinstance(value, str): |
| 653 | + return cast(R, float(value)) |
| 654 | + elif isinstance(aggregator, AverageAggregator) and isinstance(value, str): |
| 655 | + return cast(R, float(value)) |
| 656 | + elif isinstance(aggregator, PriorityAggregator): |
| 657 | + pri_agg: PriorityAggregator = cast(PriorityAggregator, aggregator) |
| 658 | + if isinstance(pri_agg.aggregator, SumAggregator) and isinstance(value, str): |
| 659 | + return cast(R, float(value)) |
| 660 | + elif isinstance(pri_agg.aggregator, AverageAggregator) and isinstance(value, str): |
| 661 | + return cast(R, float(value)) |
| 662 | + # end compatibility with 22.06 |
| 663 | + |
651 | 664 | return cast(R, value)
|
652 | 665 |
|
653 | 666 | @_pre_call_cache
|
|
0 commit comments