Skip to content

Commit

Permalink
Merge pull request #8684 from youngsofun/fix2
Browse files Browse the repository at this point in the history
fix(copy): fix wrong asserts.
  • Loading branch information
BohuTANG authored Nov 7, 2022
2 parents 91f6fd7 + cbc23b4 commit 422b802
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ impl<T: InputFormatTextBase> AligningStateTrait for AligningState<T> {
T::align(self, &buf)?
} else {
if let Some(decoder) = &self.decoder {
assert_eq!(decoder.state(), DecompressState::Done)
let state = decoder.state();
if !matches!(state, DecompressState::Done | DecompressState::Reading) {
tracing::warn!("decompressor end with state {:?}", state)
}
}
self.flush()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use common_base::base::tokio::sync::mpsc::Sender;
use common_base::base::GlobalIORuntime;
use common_base::base::TrySpawn;
use common_datablocks::DataBlock;
use common_exception::ErrorCode;
use common_exception::Result;
use common_pipeline_core::Pipeline;
use futures::AsyncRead;
Expand Down Expand Up @@ -288,6 +289,12 @@ pub trait InputFormatPipe: Sized + Send + 'static {
let mut batch = vec![0u8; batch_size];
let n = read_full(&mut reader, &mut batch[0..]).await?;
if n == 0 {
if total_read != size {
return Err(ErrorCode::BadBytes(format!(
"split {} expect {} bytes, read only {} bytes",
split_info, size, total_read
)));
}
break;
} else {
total_read += n;
Expand All @@ -299,7 +306,6 @@ pub trait InputFormatPipe: Sized + Send + 'static {
}
}
}
assert_eq!(total_read, size);
tracing::debug!("finished");
Ok(())
}
Expand Down

1 comment on commit 422b802

@vercel
Copy link

@vercel vercel bot commented on 422b802 Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend.vercel.app
databend-databend.vercel.app
databend.rs
databend-git-main-databend.vercel.app

Please sign in to comment.