Skip to content

Consideration of Type Safety #199

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

Open
JakkuSakura opened this issue Jan 26, 2025 · 3 comments
Open

Consideration of Type Safety #199

JakkuSakura opened this issue Jan 26, 2025 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@JakkuSakura
Copy link

Are there any considerations/plans regarding type safety?

Sometimes, a slight mismatch between the DDL and rust struct will cause strange errors. If we add checks about type safety, these errors could be solved more easily

@JakkuSakura JakkuSakura added the enhancement New feature or request label Jan 26, 2025
@stepancheg
Copy link

Yes. Errors look like this:

Code: 33. DB::Exception: Cannot read all data. Bytes read: 3. Bytes expected: 8.: (at row 1)\n: While executing BinaryRowInputFormat. (CANNOT_READ_ALL_DATA)

Unhelpful, hard to debug.

And prevents schema migration. For example, if you database type changed from non-null string to nullable string, it is not possible to write an inserter code which handles both old and new versions of the schema.

And can lead to insertion of garbage into table if accidentally the number of bytes will match.

@slvrtrn
Copy link
Contributor

slvrtrn commented May 13, 2025

We are looking into possibilities of using RowBinaryWithNamesAndTypes as the default format, so there will be stronger safety guarantees and better errors in case of struct mismatch with DDL. Can't give any ETA yet, as this is currently on the draft stage, and we need to be sure that we get the implementation right.

@slvrtrn
Copy link
Contributor

slvrtrn commented May 20, 2025

Here's a draft PR that adds RowBinaryWithNamesAndTypes support on Query for stricter safety guarantees: #221. Your feedback is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants