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

Writing bytes to String column fails (INTERNAL EXCEPTION WHILE SERIALIZING) #148

Closed
TimNooren opened this issue Mar 14, 2023 · 2 comments · Fixed by #149
Closed

Writing bytes to String column fails (INTERNAL EXCEPTION WHILE SERIALIZING) #148

TimNooren opened this issue Mar 14, 2023 · 2 comments · Fixed by #149
Labels
enhancement New feature or request

Comments

@TimNooren
Copy link

Writing bytes to a String column fails with INTERNAL EXCEPTION WHILE SERIALIZING. Writing bytes to FixedString works as expected, so I assume the same should be possible with String columns. But I'm very new to Clickhouse, so I may have missed something:)

Steps to reproduce

See main...TimNooren:clickhouse-connect:string_accepts_bytes for a unit test that illustrates the issue, and a naive fix.

Configuration

Environment

  • clickhouse-connect version: 0.5.15
  • Python version: 3.11.12
  • Operating system: macOS (ARM)
@TimNooren TimNooren added the bug Something isn't working label Mar 14, 2023
@genzgd
Copy link
Collaborator

genzgd commented Mar 14, 2023

Thanks for opening this issue and taking the time to investigate a fix. Accepting bytes for a string column makes perfect sense and I'm surprised no one has mentioned it before.

My only concern with your fix is performance, since string writes are already slow and an extra type check and assignment are going to make that slightly worse. But I can address that later as part of #106. For a short term fix I'm inclined to use the same approach as other columns, and assume that all values in the column are the same type as the first (non-NULL) value and write all strings or all bytes objects as appropriate.

@genzgd genzgd added enhancement New feature or request and removed bug Something isn't working labels Mar 15, 2023
@genzgd genzgd mentioned this issue Mar 15, 2023
2 tasks
@TimNooren
Copy link
Author

@genzgd Makes sense to at least use the same approach as for FixedString👍 Would be happy to submit a PR, but I see you already covered it. Thanks:)

@genzgd genzgd linked a pull request Mar 15, 2023 that will close this issue
2 tasks
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

Successfully merging a pull request may close this issue.

2 participants