hazelcast / hazelcast/hazelcast-python-client

Update Serializers (ArrayListSerializer, LinkedListSerializer and others) [API-1114]

Open
#522 1 comment 0 reactions 0 assignees View on GitHub
Estimation: M Source: Internal to-jira Type: Defect
Dominant language
Python
Stars
116
Forks
78
Avg merge
10d 22h
Merged PRs (30d)
1

Description

Right now some serializers like ArrayListSerializer and LinkedListSerializer(maybe even more) are out of date. We were using NULL_ARRAY_LENGTH in serialization of these before 2019. It is changed in this pr: https://github.com/hazelcast/hazelcast/pull/15371/files

The ArrayListSerializer for example, never encounters with "None" input, since null has its own serializer. So there is an unnecessary check in the serializer.

```py
class ArrayListSerializer(BaseSerializer):
def read(self, inp):
size = inp.read_int()
if size > NULL_ARRAY_LENGTH:
return [inp.read_object() for _ in range(0, size)]
return None

def write(self, out, obj):
size = NULL_ARRAY_LENGTH if obj is None else len(obj)
out.write_int(size)
for i in range(0, size):
out.write_object(obj[i])

def get_type_id(self):
return JAVA_DEFAULT_TYPE_ARRAY_LIST
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.