This repository was archived by the owner on Jul 11, 2025. It is now read-only.
This repository was archived by the owner on Jul 11, 2025. It is now read-only.
Can you help me with alterpartitionreassignment #211
Open
Description
Hello, i understand, that partition reassignment is not public api for now, but i am need to use it. When use get strange errors with code like this
topics = [{
"name": "supertopic",
"partitions": [{
"partitions_index": 0,
"replicas": [2],
"tags": {},
}],
"tags": {},
}]
return AlterPartitionReassignmentsRequest_v0(
timeout_ms=timeout,
topics=partitions
)
Error is KeyError: 0
It happens when tries to encode object in CompactArray,
class CompactArray(Array):
def encode(self, items):
if items is None:
return UnsignedVarInt32.encode(0)
return b''.join(
[UnsignedVarInt32.encode(len(items) + 1)] +
--> [self.array_of.encode(item) for item in items]
)
def decode(self, data):
length = UnsignedVarInt32.decode(data) - 1
if length == -1:
return None
return [self.array_of.decode(data) for _ in range(length)]
When encoding it put should put array in encode method, not dict
Metadata
Metadata
Assignees
Labels
No labels