Skip to content

Commit

Permalink
format and put behind feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 authored and rtyler committed Jan 28, 2023
1 parent 8b788dc commit aecccba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,7 @@ harness = false
[[example]]
name = "basic_operations"
required-features = ["datafusion"]

[[example]]
name = "recordbatch-writer"
required-features = ["arrow"]
10 changes: 3 additions & 7 deletions rust/examples/recordbatch-writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use deltalake::writer::{DeltaWriter, RecordBatchWriter};
use deltalake::*;
use log::*;

use std::collections::HashMap;
use object_store::path::Path;
use std::collections::HashMap;
use std::sync::Arc;

/*
Expand All @@ -38,10 +38,8 @@ async fn main() -> Result<(), anyhow::Error> {
Err(DeltaTableError::NotATable(_)) => {
info!("It doesn't look like our delta table has been created");
create_initialized_table(&table_path).await
},
Err(err) => {
Err(err).unwrap()
}
Err(err) => Err(err).unwrap(),
};

let mut writer =
Expand Down Expand Up @@ -191,9 +189,7 @@ fn convert_to_batch(table: &DeltaTable, records: &Vec<WeatherRecord>) -> RecordB
* Table in an existing directory that doesn't currently contain a Delta table
*/
async fn create_initialized_table(table_path: &Path) -> DeltaTable {
let mut table = DeltaTableBuilder::from_uri(table_path)
.build()
.unwrap();
let mut table = DeltaTableBuilder::from_uri(table_path).build().unwrap();
let table_schema = WeatherRecord::schema();
let mut commit_info = serde_json::Map::<String, serde_json::Value>::new();
commit_info.insert(
Expand Down

0 comments on commit aecccba

Please sign in to comment.