Skip to content

_serialize_val() treats int64 as a long instead of long long #2942

@vtao2

Description

@vtao2

Expected Behavior

In key_encoding_utils.py, when serializing an int64, we should be able to serialize int64 numbers (up to 2^64 - 1).

Current Behavior

Currently, we get:

struct.error: 'l' format requires -2147483648 <= number <= 2147483647

but l is for long, which is 4 bytes. int64 should be 8 bytes, thus q, representing long long.
Source: https://docs.python.org/3.10/library/struct.html#format-characters

Steps to reproduce

Call _serialize_val() on a number > 2147483647.

Specifications

  • Version: 0.22
  • Platform:
  • Subsystem:

Possible Solution

return struct.pack("<l", v.int64_val), ValueType.INT64 --> return struct.pack("<q", v.int64_val), ValueType.INT64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions