Skip to content
10 changes: 10 additions & 0 deletions datafusion/proto/proto/datafusion.proto
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ message PhysicalPlanNode {
CooperativeExecNode cooperative = 32;
GenerateSeriesNode generate_series = 33;
SortMergeJoinExecNode sort_merge_join = 34;
MemoryScanExecNode memory_scan = 35;
}
}

Expand Down Expand Up @@ -1041,6 +1042,15 @@ message AvroScanExecNode {
FileScanExecConf base_conf = 1;
}

message MemoryScanExecNode {
repeated bytes partitions = 1;
datafusion_common.Schema schema = 2;
repeated uint32 projection = 3;
repeated PhysicalSortExprNodeCollection sort_information = 4;
bool show_sizes = 5;
optional uint32 fetch = 6;
}

message CooperativeExecNode {
PhysicalPlanNode input = 1;
}
Expand Down
200 changes: 200 additions & 0 deletions datafusion/proto/src/generated/pbjson.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion datafusion/proto/src/generated/prost.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions datafusion/proto/src/physical_plan/from_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

use std::sync::Arc;

use arrow::array::RecordBatch;
use arrow::compute::SortOptions;
use arrow::datatypes::Field;
use arrow::ipc::reader::StreamReader;
use chrono::{TimeZone, Utc};
use datafusion_expr::dml::InsertOp;
use object_store::path::Path;
Expand Down Expand Up @@ -556,6 +558,18 @@ pub fn parse_protobuf_file_scan_config(
Ok(config)
}

pub fn parse_record_batches(buf: &[u8]) -> Result<Vec<RecordBatch>> {
if buf.is_empty() {
return Ok(vec![]);
}
let reader = StreamReader::try_new(buf, None)?;
let mut batches = Vec::new();
for batch in reader {
batches.push(batch?);
}
Ok(batches)
}

impl TryFrom<&protobuf::PartitionedFile> for PartitionedFile {
type Error = DataFusionError;

Expand Down
Loading