You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just cloned the repo and added the following (failing) test case:
#[tokio::test]asyncfnmultiple_booleans(){let client = prepare_database!();#[derive(Row,Deserialize)]structRow{a:bool,b:bool,}let row = client
.query("WITH ( select true ) as a, ( select true ) as b SELECT ?fields").fetch_one::<Row>().await.unwrap();assert_eq!(row.a, true);assert_eq!(row.b, true);}
One bool is false, the other is true.
I haven't had time yet to dig into the library code to diagnose the issue. Perhaps this is an easy fix for the author. If not, I'd be more than happy to look in to this next week.
The text was updated successfully, but these errors were encountered:
Oh, wait, it's four bytes instead of two, compared to
clickhouse-client -q 'SELECT true AS a, true AS b FORMAT RowBinary' | hx
0x000000: 0x01 0x01 ..
bytes: 2
The reason is that the actual returned type corresponding to Option<bool>:
#[derive(Debug, Row, Deserialize)]
struct Row {
a: Option<bool>,
b: Option<bool>,
}
let row = client
.query("WITH (SELECT true) as a, (SELECT true) as b SELECT ?fields")
.fetch_one::<Row>()
.await
.unwrap();
assert_eq!(row.a, Some(true));
assert_eq!(row.b, Some(true));
RowBinaryWithNamesAndTypes also confirms this:
clickhouse-client -q 'WITH (SELECT true) AS a, (SELECT true) AS b SELECT a, b FORMAT RowBinaryWithNamesAndTypes' | hx
0x000000: 0x02 0x01 0x61 0x01 0x62 0x0e 0x4e 0x75 0x6c 0x6c ..a.b.Null
0x00000a: 0x61 0x62 0x6c 0x65 0x28 0x42 0x6f 0x6f 0x6c 0x29 able(Bool)
0x000014: 0x0e 0x4e 0x75 0x6c 0x6c 0x61 0x62 0x6c 0x65 0x28 .Nullable(
0x00001e: 0x42 0x6f 0x6f 0x6c 0x29 0x00 0x01 0x00 0x01 Bool)....
bytes: 39
I don't think it can be fixed (more precisely, made more prominent) without #10 (or moving to the Native format), where it can be cast to the requested type.
I've just cloned the repo and added the following (failing) test case:
One bool is false, the other is true.
I haven't had time yet to dig into the library code to diagnose the issue. Perhaps this is an easy fix for the author. If not, I'd be more than happy to look in to this next week.
The text was updated successfully, but these errors were encountered: