Skip to content
Closed
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
4 changes: 3 additions & 1 deletion rust/arrow/src/json/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,9 @@ mod tests {
let read = batch.column(0);
assert!(
expected.data_ref() == read.data_ref(),
format!("{:?} != {:?}", expected.data(), read.data())
"{:?} != {:?}",
expected.data(),
read.data(),
);
}

Expand Down
6 changes: 3 additions & 3 deletions rust/arrow/src/json/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ pub fn array_to_json_array(array: &ArrayRef) -> Vec<Value> {
jsonmaps.into_iter().map(Value::Object).collect()
}
_ => {
panic!(format!(
panic!(
"Unsupported datatype for array conversion: {:#?}",
array.data_type()
));
);
}
}
}
Expand Down Expand Up @@ -281,7 +281,7 @@ fn set_column_for_json_rows(
});
}
_ => {
panic!(format!("Unsupported datatype: {:#?}", array.data_type()));
panic!("Unsupported datatype: {:#?}", array.data_type());
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions rust/arrow/src/record_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,13 @@ impl From<&StructArray> for RecordBatch {
}
}

impl Into<StructArray> for RecordBatch {
fn into(self) -> StructArray {
self.schema
impl From<RecordBatch> for StructArray {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a good one. 👍

fn from(batch: RecordBatch) -> Self {
batch
.schema
.fields
.iter()
.zip(self.columns.iter())
.zip(batch.columns.iter())
.map(|t| (t.0.clone(), t.1.clone()))
.collect::<Vec<(Field, ArrayRef)>>()
.into()
Expand Down
4 changes: 2 additions & 2 deletions rust/arrow/src/util/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn get_temp_file(file_name: &str, content: &[u8]) -> fs::File {
pub fn arrow_test_data() -> String {
match get_data_dir("ARROW_TEST_DATA", "../../testing/data") {
Ok(pb) => pb.display().to_string(),
Err(err) => panic!(format!("failed to get arrow data dir: {}", err)),
Err(err) => panic!("failed to get arrow data dir: {}", err),
}
}

Expand All @@ -103,7 +103,7 @@ pub fn parquet_test_data() -> String {
"../../cpp/submodules/parquet-testing/data",
) {
Ok(pb) => pb.display().to_string(),
Err(err) => panic!(format!("failed to get parquet data dir: {}", err)),
Err(err) => panic!("failed to get parquet data dir: {}", err),
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/datafusion/src/physical_plan/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ mod tests {
"Expression {:?} expected to error due to impossible coercion",
case
);
assert!(logical_plan.is_err(), message);
assert!(logical_plan.is_err(), "{}", message);
}
Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn main() -> Result<()> {
"JSON_TO_ARROW" => json_to_arrow(json_file, arrow_file, verbose),
"ARROW_TO_JSON" => arrow_to_json(arrow_file, json_file, verbose),
"VALIDATE" => validate(arrow_file, json_file, verbose),
_ => panic!(format!("mode {} not supported", mode)),
_ => panic!("mode {} not supported", mode),
}
}

Expand Down