fix(clickhouse handler): try catch error before response.
@@ -139,9 +139,28 @@ async fn execute(
rb
}
};
+
+ let mut blocks: Vec<Result<Vec<u8>>> = vec![];
+ for _ in 0..2 {
+ match data_stream.next().await {
+ Some(block) => {
+ match block {
+ Ok(block) => {
+ blocks.push(compress_fn(output_format.serialize_block(&block)));
+ }
+ Err(err) => return Err(err),
+ };
+ }
+ None => break,
+ }
+ }
+
let session = ctx.get_current_session();
let stream = stream! {
yield compress_fn(prefix);
+ for b in blocks {
+ yield b;
+ }
let mut ok = true;
while let Some(block) = data_stream.next().await {
match block{
