apache / apache/sedona-db

Row/Column count where possible on output

Open
#105 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
503
Forks
61
Avg merge
2d 4h
Merged PRs (30d)
90

Description

We can almost certainly do better than what is currently being printed to communicate result size, particularly where we've limited. For example:

```python
import sedona.db

sd = sedona.db.connect()
sd.sql("SELECT v FROM (VALUES ('a'), ('b'), ('c')) AS t(v)").limit(100).show()
#> ┌──────┐
#> │ v │
#> │ utf8 │
#> ╞══════╡
#> │ a │
#> ├╌╌╌╌╌╌┤
#> │ b │
#> ├╌╌╌╌╌╌┤
#> │ c │
#> └──────┘
```

A column count might be nice as well, since for very wide output columns get hidden:

```python
sd.sql(
"SELECT 'foofyfoofyfoofy' AS foofy_foofy_foofy, 1 AS one, 'foofyfoofyfoofy2' AS foofy_foofy_foofy2"
).show(width=25)
#> ┌───┬───────────────────┐
#> │ … ┆ foofy_foofy_foofy │
#> │ ┆ 2… │
#> ╞═══╪═══════════════════╡
#> │ … ┆ foofyfoofyfoofy2 │
#> └───┴───────────────────┘
```

The current workaround is to just look at the `.schema`:

```python
sd.sql(
"SELECT 'foofyfoofyfoofy' AS foofy_foofy_foofy, 1 AS one, 'foofyfoofyfoofy2' AS foofy_foofy_foofy2"
).schema
#> SedonaSchema with 3 fields:
#> foofy_foofy_foofy: non-nullable utf8
#> one: non-nullable int64
#> foofy_foofy_foofy2: non-nullable utf8
```

Contributor guide

Open the contributing guide

Research direction

Start with the Python show() examples and inspect the implementation that formats query results, including behavior for limit() and narrow widths. The change is done when output communicates available row and column counts without breaking the demonstrated formatting or schema behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.