Skip to content

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

Closed

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

Activity

  1. achals commented on Jul 15, 2022

    @achals
    Member

    @vtao2 you've stumbled onto a long standing bug (#1908, #2345) 🙁

    Good news is it's on my plate to fix this in the coming sprint. I should have an update soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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