Skip to content

[Python][C++] Crash when performing join on a table larger than INT32_MAX bytes #36879

Closed as duplicate

Description

@rowillia

Describe the bug, including details regarding any error messages, version, and platform.

pyarrow version: 12.0.1

Minimal Repro:

import pyarrow as pa

ROW_COUNT = 15_000
query = pa.Table.from_pydict({
    "key": [bytes.fromhex('ABC123'), bytes.fromhex('DEF431')]
})
t = pa.Table.from_pydict(
    {
        "blob_2": [x.to_bytes(4, 'little') * 25_000 for x in range(ROW_COUNT)],
        "blob_1": [x.to_bytes(4, 'little') * 25_000 for x in range(ROW_COUNT)],
        "key": [x.to_bytes(4, 'little') for x in range(ROW_COUNT)]
    },
    schema=pa.schema(
        [
            ("blob_2", pa.large_binary()),
            ("blob_1", pa.large_binary()),
            ("key", pa.binary()),
        ]
    )
)
print(f"Table size: {t.nbytes} bytes (bigger than INT_MAX: {t.nbytes > (1 << 31)})")
for x in range(10):
    print(f"Attempt {x}")
    _ = query.join(t, 'key', join_type="inner")

Executing this results in a segfault:

terminate called after throwing an instance of 'std::length_error'
  what():  vector::_M_default_append

Note that flipping the join (e.g. _ = t.join(q, 'key', join_type="inner")) no longer segfaults.

Component(s)

C++

Activity

  1. changed the title [-]Crash when performing `join` on a table larger than INT32_MAX bytes[/-] [+][Python][C++] Crash when performing `join` on a table larger than INT32_MAX bytes[/+] on Jul 26, 2023
  2. idailylife commented on Jan 23, 2024

    @idailylife
    Contributor

    Is this (#33151) related?

  3. zanmato1984 commented on Oct 22, 2026

    @zanmato1984
    Contributor

    This is the same Basic Hash Join / RowEncoder overflow as #54885, but in the build-side payload rather than the keys.

    The large_binary columns select Basic Join. Their combined encoded size exceeds its signed 32-bit offset range, even though each column alone is below 2 GiB. Reversing the inputs makes the small table the build side and avoids that accumulation.

    Closed as a duplicate of #54885; the underlying bug remains unresolved.

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