Skip to content

Commit e1faff7

Browse files
authored
fix: be adaptive to the log schema changing in inspect-table (delta-io#1368)
1 parent 82fa82e commit e1faff7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • kernel/examples/inspect-table/src

kernel/examples/inspect-table/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl LogVisitor {
8686
let mut it = NAMES_AND_TYPES.as_ref().0.iter().enumerate().peekable();
8787
while let Some((start, col)) = it.next() {
8888
let mut end = start + 1;
89+
// move forward while the top level struct has the same name
8990
while it.next_if(|(_, other)| col[0] == other[0]).is_some() {
9091
end += 1;
9192
}
@@ -104,9 +105,10 @@ impl RowVisitor for LogVisitor {
104105
NAMES_AND_TYPES.as_ref()
105106
}
106107
fn visit<'a>(&mut self, row_count: usize, getters: &[&'a dyn GetData<'a>]) -> DeltaResult<()> {
107-
if getters.len() != 55 {
108+
let expected = NAMES_AND_TYPES.as_ref().0.len();
109+
if getters.len() != expected {
108110
return Err(Error::InternalError(format!(
109-
"Wrong number of LogVisitor getters: {}",
111+
"Wrong number of LogVisitor getters: {}, expected {expected}",
110112
getters.len()
111113
)));
112114
}

0 commit comments

Comments
 (0)