Skip to content

Conversation

@paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Jan 30, 2026

Fixes a panic when the content of a table is unexpectedly large. The first issue I hit this was was explain plans.

In addition to at least one issue here, there is quite a lot of unchecked addition in the underlying renderer, which we work around by truncating any u16s or strings to 32,000.

Reprex from original issue now renders without panicing:

import sedona.db

sd = sedona.db.connect()

buildings_url = (
    "s3://overturemaps-us-west-2/release/2026-01-21.0/theme=buildings/type=building/"
)

target_wkt = (
    "POLYGON ((-73.21 44.03, -73.21 43.98, -73.11 43.97, -73.12 44.03, -73.21 44.03))"
)

sd.read_parquet(
    buildings_url,
    options={"aws.skip_signature": True, "aws.region": "us-west-2"},
).to_view("buildings")

sd.sql(f"""
SELECT count(*) FROM buildings
WHERE ST_Intersects(geometry, ST_SetSRID(ST_GeomFromText('{target_wkt}'), 4326))
""").explain("extended").show()
#> ...very, very long output that does not crash

Closes #388.

@paleolimbot paleolimbot marked this pull request as ready for review January 30, 2026 23:04
@paleolimbot paleolimbot requested a review from Copilot January 30, 2026 23:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a panic that occurred when displaying tables with unexpectedly large content, particularly in explain plans. The fix addresses unchecked arithmetic operations that could cause integer overflow by introducing saturating addition and conservative maximum width limits.

Changes:

  • Introduced WIDTH_MAX constant (32,000) to prevent overflow in comfy table's internal arithmetic
  • Replaced unchecked addition with saturating_add throughout width calculations
  • Added content truncation in the cell method to limit string length to WIDTH_MAX

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Attempt to show() value > 65536 characters wide results in a panic

1 participant