This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
992a38b
commit f0bd8ec
Showing
4 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
use std::fs; | ||
use substrait::proto::Plan; | ||
use substrait::proto::{Plan, ReadRel}; | ||
|
||
pub fn read_str(path: &str) -> String { | ||
fs::read_to_string(path).unwrap_or_else(|_| panic!("Unable to read file {}", path)) | ||
} | ||
|
||
pub fn get_json(path: &str) -> Plan { | ||
pub fn get_plan(path: &str) -> Plan { | ||
let plan = serde_json::from_str::<Plan>(&read_str(path)) | ||
.unwrap_or_else(|_| panic!("Could not parse json {:?} into Plan", path)); | ||
println!("{}", serde_json::to_string_pretty(&plan).unwrap()); | ||
plan | ||
} | ||
|
||
pub fn get_read(path: &str) -> ReadRel { | ||
let read = serde_json::from_str::<ReadRel>(&read_str(path)) | ||
.unwrap_or_else(|_| panic!("Could not parse json {:?} into Plan", path)); | ||
println!("{}", serde_json::to_string_pretty(&read).unwrap()); | ||
read | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod deserialize; | ||
pub mod example; | ||
pub mod substrait_arrow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use arrow::datatypes::{DataType, Schema}; | ||
use std::sync::Arc; | ||
use substrait::proto::{Type, NamedStruct}; | ||
|
||
/// https://docs.rs/substrait/latest/substrait/proto/struct.NamedStruct.html | ||
/// https://docs.rs/substrait/latest/substrait/proto/type/struct.Struct.html | ||
pub fn schema_translate(substrait_schema: NamedStruct) -> Arc<Schema> { | ||
for (i, name) in substrait_schema.names.iter().enumerate() { | ||
todo!() | ||
} | ||
|
||
todo!() | ||
} | ||
|
||
/// https://docs.rs/substrait/latest/substrait/proto/struct.Type.html | ||
/// https://docs.rs/arrow/latest/arrow/datatypes/enum.DataType.html | ||
pub fn type_translate(typ: Type) -> DataType { | ||
todo!() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters