Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add general re_sorbet::SorbetSchema #9017

Merged
merged 9 commits into from
Feb 13, 2025
Merged

Add general re_sorbet::SorbetSchema #9017

merged 9 commits into from
Feb 13, 2025

Conversation

emilk
Copy link
Member

@emilk emilk commented Feb 12, 2025

Related

What

Expand re_sorbet with SorbetSchema and SorbetBatch - a superset of the existing ChunkSchema and ChunkBatch.

How

I'm using a pretty ugly interesting approach of "fake inheritance":

Define A -> B as:

  • struct A contains a B
  • impl Deref<Target=B> for A (upcasting)
  • impl TryFrom<B> for A (“downcasting”)
  • impl From<A> for B (“object slicing”)

Using this notation:

  • ChunkSchema -> SorbetSchema
  • ChunkBatch -> SorbetBatch -> arrow::RecordBatch

This means the ChunkBatch can be used as SorbetBatch but also as an arrow::RecordBatch.

Note that there is no dynamic dispatch involved at all.

@emilk emilk added exclude from changelog PRs with this won't show up in CHANGELOG.md 🔩 data model Sorbet labels Feb 12, 2025
Copy link

github-actions bot commented Feb 12, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
1861d5c https://rerun.io/viewer/pr/9017 +nightly +main

Note: This comment is updated whenever you push a commit.

@emilk
Copy link
Member Author

emilk commented Feb 12, 2025

@rerun-bot full-check

Copy link

@emilk
Copy link
Member Author

emilk commented Feb 12, 2025

@rerun-bot full-check

@emilk emilk marked this pull request as ready for review February 12, 2025 17:59
Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/13291795215

@emilk emilk force-pushed the emilk/sorbet-batch branch from 44a1d8b to 07f5f1a Compare February 12, 2025 19:44
@emilk emilk force-pushed the emilk/sorbet-batch branch from 07f5f1a to fd930c4 Compare February 12, 2025 19:45
@emilk
Copy link
Member Author

emilk commented Feb 12, 2025

@rerun-bot full-check

Copy link

@emilk
Copy link
Member Author

emilk commented Feb 12, 2025

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/13293864264

@abey79 abey79 self-requested a review February 13, 2025 08:25
Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

This is looking great!

@abey79 abey79 merged commit 45353c2 into main Feb 13, 2025
73 checks passed
@abey79 abey79 deleted the emilk/sorbet-batch branch February 13, 2025 08:44
jprochazk pushed a commit that referenced this pull request Feb 13, 2025
### Related
* Part of #8744

### What
Expand `re_sorbet` with `SorbetSchema` and `SorbetBatch` - a superset of
the existing `ChunkSchema` and `ChunkBatch`.

### How
I'm using a pretty ~ugly~ interesting approach of "fake inheritance":

Define `A` -> `B` as:
* `struct A` contains a `B`
* `impl Deref<Target=B> for A` (upcasting)
* `impl TryFrom<B> for A` (“downcasting”)
* `impl From<A> for B` (“object slicing”)

Using this notation:
* `ChunkSchema` -> `SorbetSchema`
* `ChunkBatch` -> `SorbetBatch` -> `arrow::RecordBatch`

This means the `ChunkBatch` can be used as `SorbetBatch` but also as an
`arrow::RecordBatch`.

Note that there is no dynamic dispatch involved at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔩 data model Sorbet exclude from changelog PRs with this won't show up in CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants