From d97737d2e60a6d9c60bb1cb10c3170b6a038e8e8 Mon Sep 17 00:00:00 2001 From: Yaniv Michael Kaul Date: Thu, 5 Feb 2026 20:07:26 +0200 Subject: [PATCH] Fix: Add missing serial_size() method to ShortType ShortType (smallint) is a fixed-size type (2 bytes) but was missing the serial_size() classmethod. This prevented optimizations that depend on knowing the fixed size of elements, such as the struct.unpack optimization in VectorType deserialization. All other fixed-size numeric types (Int32Type, LongType, FloatType, DoubleType, BooleanType) already have serial_size() defined. Signed-off-by: Yaniv Kaul --- cassandra/cqltypes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cassandra/cqltypes.py b/cassandra/cqltypes.py index e36c48563c..114be3f405 100644 --- a/cassandra/cqltypes.py +++ b/cassandra/cqltypes.py @@ -730,6 +730,10 @@ def deserialize(byts, protocol_version): def serialize(byts, protocol_version): return int16_pack(byts) + @classmethod + def serial_size(cls): + return 2 + class TimeType(_CassandraType): typename = 'time' # Time should be a fixed size 8 byte type but Cassandra 5.0 code marks it as