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

fix: schema mismatch during write #966

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions analytic_engine/src/instance/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ impl<'a> MemTableWriter<'a> {
// inserting memtable? RocksDB checks memtable size in MemTableInserter
/// Write data into memtable.
///
/// The data in `encoded_rows` will be moved to memtable.
///
/// The len of `row_group` and `encoded_rows` must be equal.
/// index_in_writer must match the schema in table_data.
pub fn write(
&self,
sequence: SequenceNumber,
Expand All @@ -295,7 +293,7 @@ impl<'a> MemTableWriter<'a> {
return Ok(());
}

let schema = row_group.schema();
let schema = &self.table_data.schema();
// Store all memtables we wrote and update their last sequence later.
let mut wrote_memtables: SmallVec<[_; 4]> = SmallVec::new();
let mut last_mutable_mem: Option<MemTableForWrite> = None;
Expand Down
3 changes: 1 addition & 2 deletions analytic_engine/src/table/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,11 @@ impl TableData {
timestamp: Timestamp,
table_schema: &Schema,
) -> Result<MemTableForWrite> {
let schema_version = table_schema.version();
let last_sequence = self.last_sequence();

if let Some(mem) = self
.current_version
.memtable_for_write(timestamp, schema_version)
.memtable_for_write(timestamp, table_schema.version())
.context(FindMemTable)?
{
return Ok(mem);
Expand Down
2 changes: 0 additions & 2 deletions common_types/src/row/contiguous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ impl<'a, T: RowBuffer + 'a> ContiguousRowWriter<'a, T> {
self.inner
.reset(datum_buffer_len, DatumKind::Null.into_u8());

assert_eq!(row.num_columns(), self.table_schema.num_columns());

// Offset to next string in string buffer.
let mut next_string_offset: OffsetSize = 0;
for index_in_table in 0..self.table_schema.num_columns() {
Expand Down