MCPcopy Create free account
hub / github.com/apache/datafusion / serialize

Function serialize

datafusion/substrait/src/serializer.rs:36–51  ·  view source on GitHub ↗

Plans a sql and serializes the generated logical plan to bytes. The bytes are then written into a file at `path`. Returns an error if the file already exists.

(
    sql: &str,
    ctx: &SessionContext,
    path: impl AsRef<Path>,
)

Source from the content-addressed store, hash-verified

34///
35/// Returns an error if the file already exists.
36pub async fn serialize(
37 sql: &str,
38 ctx: &SessionContext,
39 path: impl AsRef<Path>,
40) -> Result<()> {
41 let protobuf_out = serialize_bytes(sql, ctx).await?;
42
43 let mut file = OpenOptions::new()
44 .write(true)
45 .create_new(true)
46 .open(path)
47 .await?;
48 file.write_all(&protobuf_out).await?;
49 file.flush().await?;
50 Ok(())
51}
52
53/// Plans a sql and serializes the generated logical plan to bytes.
54pub async fn serialize_bytes(sql: &str, ctx: &SessionContext) -> Result<Vec<u8>> {

Callers 2

serialize_to_fileFunction · 0.85
serialize_simple_selectFunction · 0.85

Calls 6

serialize_bytesFunction · 0.85
newFunction · 0.85
openMethod · 0.45
writeMethod · 0.45
write_allMethod · 0.45
flushMethod · 0.45

Tested by 2

serialize_to_fileFunction · 0.68
serialize_simple_selectFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…