Skip to content

[C++] Use signed arithmetic for frame of reference in DeltaBitPackEncoder #37939

Closed

Description

@etseidl

Describe the enhancement requested

The current implementation of DeltaBitPackEncoder uses unsigned arithmetic to handle possible overflow when calculating deltas (see here). This has unfortunate consequences when encoding small negative deltas. As an example, writing a vector with values {1, 0, -1, 0, 1, 0, -1, 0, 1} produces the following output (starting at the delta binary header):

00000030:                          8001 0409 0202  ................
00000040: 2000 0000 feff ffff feff ffff 0000 0000   ...............
00000050: 0000 0000 feff ffff feff ffff 0000 0000  ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000c0: 0000 0000

The encoder uses a bit width of 32 for all values. If signed values are used instead, then the result is:

00000030:                     8001 0409 0201 0200  ................
00000040: 0000 a0a0 0000 0000 0000

Here the encoder can use 2 bits per value. This can result in much smaller files, especially in cases where the logical type is less than 32 bits.

Component(s)

C++

Activity

  1. added a commit that references this issue on Oct 3, 2023
  2. added this to the 14.0.0 milestone on Oct 3, 2023
  3. added a commit that references this issue on Nov 13, 2023
  4. added a commit that references this issue on Feb 19, 2024
  5. added a commit that references this issue on Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions