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

CANNOT_READ_ALL_DATA on inserter commit/end #57

Closed
jjtt opened this issue Mar 21, 2023 · 4 comments
Closed

CANNOT_READ_ALL_DATA on inserter commit/end #57

jjtt opened this issue Mar 21, 2023 · 4 comments

Comments

@jjtt
Copy link
Contributor

jjtt commented Mar 21, 2023

I suspect that I'm doing something wrong, but I'm trying to use an inserter to write many rows to a ClickHouse db and started getting CANNOT_READ_ALL_DATA errors from the DB.

Created this simple program that demonstrates the problem while inserting just a single row: https://github.com/jjtt/clickhouse-cannot-read-all-data:

  1. run_clickhouse_server.sh - to start the latest ClickHouse docker image
  2. cargo run
  3. panic:
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BadResponse("Code: 33. DB::Exception: Cannot read all data. Bytes read: 1. Bytes expected: 8.: (at row 1)\n: While executing BinaryRowInputFormat. (CANNOT_READ_ALL_DATA) (version 23.2.3.17 (official build))")', src/main.rs:23:26
    
@loyd
Copy link
Collaborator

loyd commented Mar 21, 2023

Hi, you define end_time in SQL as non nullable, but in your Row type as end_time: Option<i64>.

Is this code generated by ch2rs? Or patched by yourself?

@jjtt
Copy link
Contributor Author

jjtt commented Mar 21, 2023

You are fast.

I just 2 minutes ago realised that I made a change to the table and did not generate the DataRow struct again.

Looks like that is my issue.

@jjtt
Copy link
Contributor Author

jjtt commented Mar 21, 2023

Thank you for your help. And for creating this crate.

I'll close this issue.

@jjtt jjtt closed this as completed Mar 21, 2023
@loyd
Copy link
Collaborator

loyd commented Mar 21, 2023

Ideally, it should be detected by the library, but it's harder for INSERT queries (because requires SELECTs to fetch a schema).

Related to #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants