Skip to content

Mark empty char values with 0x7F on every platform - #14

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

nalinigans merged 1 commit into
mainfrom
tf_empty_char_7f

Conversation

@tfenne

@tfenne tfenne commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

TILEDB_EMPTY_CHAR was CHAR_MAX, which is 127 where char is signed (x86-64, macOS) and 255 where it's unsigned (Linux aarch64 and other non-x86 Linux targets). Arrays written on Linux aarch64 therefore marked empty char cells with 0xFF and arrays written elsewhere with 0x7F, and each platform read the other's markers as values; GenomicsDB also uses it as the missing value for char fields, so a workspace imported on one platform and queried on the other read missing string fields as one-character strings. This defines it as 0x7F everywhere, replacing #11. Char data already written on Linux aarch64 keeps its 0xFF markers, which will no longer read as empty.

I also went through the rest of what TileDB writes for the same problem and found nothing else: the other empty values are fixed-width integers or IEEE floating point, TILEDB_VAR_NUM is INT_MAX, which is 32 bits everywhere TileDB builds, and the book-keeping and array schema are written as int64_t, off_t and size_t, all 64-bit on every 64-bit platform, or as non-negative bytes, apart from the compression levels in the array schema, which #13 fixes. The empty-value test now checks for 0x7F rather than CHAR_MAX. I checked it on Linux aarch64 in an AlmaLinux 8 container with GCC 15, together with #12 and #13: every test and example passes, and the test fails without this change.

TILEDB_EMPTY_CHAR was CHAR_MAX, which is 127 where char is signed and
255 where it is unsigned, as on Linux aarch64, so arrays written there
marked empty char cells with 0xFF and arrays written on x86-64 or macOS
with 0x7F, and neither read the other's as empty. It is now 0x7F
everywhere. Char data already written on Linux aarch64 keeps its 0xFF
markers, which are no longer read as empty.

@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 d8b17fd into main Oct 7, 2026
10 checks passed
@nalinigans
nalinigans deleted the tf_empty_char_7f branch October 7, 2026 18:39
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