Skip to content

Read negative compression levels correctly where char is unsigned - #13

Merged
nalinigans merged 1 commit into
mainfrom
tf_signed_compression_levels
Oct 7, 2026
Merged

nalinigans merged 1 commit into
mainfrom
tf_signed_compression_levels

Conversation

@tfenne

@tfenne tfenne commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The array schema stores each compression level in a char, and char is unsigned on Linux aarch64 and other non-x86 Linux targets, so there a level of −1, GZIP's default, reads back as 255 and GZIP compression fails with Z_STREAM_ERROR, as in tiledb_array_write_dense_1. The levels are now stored and read as int8_t. The bytes on disk are unchanged, and x86-64 and macOS read them exactly as before; on aarch64 only negative levels read differently, and a level affects only how tiles are compressed, not how they're read. #11 also fixes this, as a side effect of making char signed; this fixes it on its own, whatever happens with #11.

A new test checks that GZIP's default level reads back as written. CI has no aarch64 runner, so I checked it in an AlmaLinux 8 container on aarch64 with GCC 15, which needs #12 to build: every test and example passes, and without this change both the new test and the existing "Test array schema backward compatibility 2" fail.

The array schema stored each compression level in a char. char is
unsigned on Linux aarch64 and other non-x86 Linux targets, so there a
level of -1, GZIP's default, read back as 255 and GZIP compression
failed with Z_STREAM_ERROR. The levels are now stored and read as int8_t:
the bytes on disk are unchanged, and they read the same on every
platform. Adds a test that GZIP's default level reads back as written.

@nalinigans nalinigans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nalinigans
nalinigans merged commit b08e0d0 into main Oct 7, 2026
18 of 19 checks passed
@nalinigans
nalinigans deleted the tf_signed_compression_levels branch October 7, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants