Skip to content

Commit 60a0d74

Browse files
committed
style: apply cargo fmt
1 parent c351d32 commit 60a0d74

2 files changed

Lines changed: 25 additions & 22 deletions

File tree

‎native/build.rs‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
fn main() {
1919
println!("cargo:rerun-if-changed=../proto/session_options.proto");
20-
prost_build::compile_protos(
21-
&["../proto/session_options.proto"],
22-
&["../proto"],
23-
)
24-
.expect("failed to compile session_options.proto");
20+
prost_build::compile_protos(&["../proto/session_options.proto"], &["../proto"])
21+
.expect("failed to compile session_options.proto");
2522
}

‎native/src/proto.rs‎

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ use crate::errors::{try_unwrap_or_throw, JniResult};
3232
use crate::runtime;
3333

3434
#[no_mangle]
35-
pub extern "system" fn Java_org_apache_datafusion_SessionContext_createDataFrameFromProto<'local>(
35+
pub extern "system" fn Java_org_apache_datafusion_SessionContext_createDataFrameFromProto<
36+
'local,
37+
>(
3638
mut env: JNIEnv<'local>,
3739
_class: JClass<'local>,
3840
handle: jlong,
@@ -60,22 +62,26 @@ pub extern "system" fn Java_org_apache_datafusion_SessionContext_tableSchemaIpc<
6062
handle: jlong,
6163
name: JString<'local>,
6264
) -> jbyteArray {
63-
try_unwrap_or_throw(&mut env, std::ptr::null_mut(), |env| -> JniResult<jbyteArray> {
64-
if handle == 0 {
65-
return Err("SessionContext handle is null".into());
66-
}
67-
let ctx = unsafe { &*(handle as *const SessionContext) };
68-
let name: String = env.get_string(&name)?.into();
65+
try_unwrap_or_throw(
66+
&mut env,
67+
std::ptr::null_mut(),
68+
|env| -> JniResult<jbyteArray> {
69+
if handle == 0 {
70+
return Err("SessionContext handle is null".into());
71+
}
72+
let ctx = unsafe { &*(handle as *const SessionContext) };
73+
let name: String = env.get_string(&name)?.into();
6974

70-
let df = runtime().block_on(ctx.table(name.as_str()))?;
71-
let schema: SchemaRef = Arc::new(df.schema().as_arrow().clone());
75+
let df = runtime().block_on(ctx.table(name.as_str()))?;
76+
let schema: SchemaRef = Arc::new(df.schema().as_arrow().clone());
7277

73-
let mut buf: Vec<u8> = Vec::new();
74-
{
75-
let mut writer = StreamWriter::try_new(&mut buf, schema.as_ref())?;
76-
writer.finish()?;
77-
}
78-
let arr = env.byte_array_from_slice(&buf)?;
79-
Ok(arr.into_raw())
80-
})
78+
let mut buf: Vec<u8> = Vec::new();
79+
{
80+
let mut writer = StreamWriter::try_new(&mut buf, schema.as_ref())?;
81+
writer.finish()?;
82+
}
83+
let arr = env.byte_array_from_slice(&buf)?;
84+
Ok(arr.into_raw())
85+
},
86+
)
8187
}

0 commit comments

Comments
 (0)