Skip to content

Commit 59d12f1

Browse files
committed
COH-27563 Ensure Big Decimal, Integer serialization against 22.06 works correctly
1 parent db57751 commit 59d12f1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

coherence/client.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import grpc
3030
from pymitter import EventEmitter
3131

32-
from coherence.aggregator import EntryAggregator
32+
from coherence.aggregator import EntryAggregator, SumAggregator, AverageAggregator, PriorityAggregator
3333

3434
from .comparator import Comparator
3535
from .event import MapLifecycleEvent, MapListener, SessionLifecycleEvent
@@ -648,6 +648,19 @@ async def aggregate(
648648
r = self._request_factory.aggregate_request(aggregator, keys, filter)
649649
results = await self._client_stub.aggregate(r)
650650
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+
651664
return cast(R, value)
652665

653666
@_pre_call_cache

0 commit comments

Comments
 (0)