Skip to content

Commit

Permalink
Further tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Feb 3, 2023
1 parent 630b6ac commit 58d8872
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions arrow-cast/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,16 +678,16 @@ impl<'a> DisplayIndexState<'a> for &'a StructArray {

fn write(&self, s: &Self::State, idx: usize, f: &mut dyn Write) -> FormatResult {
let mut iter = s.iter();
f.write_char('{')?;
if let Some((name, display)) = iter.next() {
write!(f, "{{{name}: ")?;
write!(f, "{name}: ")?;
display.as_ref().write(idx, f)?;
f.write_char('}')?;
}
for (name, display) in iter {
write!(f, ", {{{name}: ")?;
write!(f, ", {name}: ")?;
display.as_ref().write(idx, f)?;
f.write_char('}')?;
}
f.write_char('}')?;
Ok(())
}
}
Expand Down
14 changes: 7 additions & 7 deletions arrow/src/util/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,13 @@ mod tests {

let table = pretty_format_batches(&[batch])?.to_string();
let expected = vec![
"+----------------------------+----+",
"| c1 | c2 |",
"+----------------------------+----+",
"| {c11: 1}, {c12: {c121: e}} | a |",
"| {c11: }, {c12: {c121: f}} | b |",
"| {c11: 5}, {c12: {c121: g}} | c |",
"+----------------------------+----+",
"+--------------------------+----+",
"| c1 | c2 |",
"+--------------------------+----+",
"| {c11: 1, c12: {c121: e}} | a |",
"| {c11: , c12: {c121: f}} | b |",
"| {c11: 5, c12: {c121: g}} | c |",
"+--------------------------+----+",
];

let actual: Vec<&str> = table.lines().collect();
Expand Down
4 changes: 2 additions & 2 deletions parquet/src/arrow/arrow_writer/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,8 +1360,8 @@ mod tests {
r#""#.to_string(),
r#""#.to_string(),
r#"[]"#.to_string(),
r#"[{"list": [3, ], "integers": null}]"#.to_string(),
r#"[, {"list": null, "integers": 5}]"#.to_string(),
r#"[{list: [3, ], integers: }]"#.to_string(),
r#"[, {list: , integers: 5}]"#.to_string(),
r#"[]"#.to_string(),
];

Expand Down
22 changes: 11 additions & 11 deletions parquet/src/arrow/arrow_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2314,17 +2314,17 @@ mod tests {
// Verify data is as expected

let expected = r#"
+-------------------------------------------------------------------------------------------------------------------------------------+
| struct_b |
+-------------------------------------------------------------------------------------------------------------------------------------+
| {"list": [{"leaf_a": 1, "leaf_b": 1}]} |
| {"list": null} |
| {"list": [{"leaf_a": 2, "leaf_b": null}, {"leaf_a": 3, "leaf_b": 2}]} |
| {"list": null} |
| {"list": [{"leaf_a": 4, "leaf_b": null}, {"leaf_a": 5, "leaf_b": null}]} |
| {"list": [{"leaf_a": 6, "leaf_b": null}, {"leaf_a": 7, "leaf_b": null}, {"leaf_a": 8, "leaf_b": null}, {"leaf_a": 9, "leaf_b": 1}]} |
| {"list": [{"leaf_a": 10, "leaf_b": null}]} |
+-------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------+
| struct_b |
+-------------------------------------------------------------------------------------------------------+
| {list: [{leaf_a: 1, leaf_b: 1}]} |
| {list: } |
| {list: [{leaf_a: 2, leaf_b: }, {leaf_a: 3, leaf_b: 2}]} |
| {list: } |
| {list: [{leaf_a: 4, leaf_b: }, {leaf_a: 5, leaf_b: }]} |
| {list: [{leaf_a: 6, leaf_b: }, {leaf_a: 7, leaf_b: }, {leaf_a: 8, leaf_b: }, {leaf_a: 9, leaf_b: 1}]} |
| {list: [{leaf_a: 10, leaf_b: }]} |
+-------------------------------------------------------------------------------------------------------+
"#.trim().split('\n').map(|x| x.trim()).collect::<Vec<_>>().join("\n");

let actual = pretty_format_batches(batches).unwrap().to_string();
Expand Down

0 comments on commit 58d8872

Please sign in to comment.