-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Very early prototype, serde is not correctly implemented for arrays, but the structure is almost there.
- Loading branch information
Showing
110 changed files
with
2,992 additions
and
946 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,46 @@ | ||
use log::LevelFilter; | ||
use std::fs::File; | ||
|
||
use bench_vortex::reader::open_vortex; | ||
use bench_vortex::setup_logger; | ||
use bench_vortex::taxi_data::taxi_data_vortex; | ||
use vortex::array::primitive::PrimitiveArray; | ||
use vortex::array::Array; | ||
use vortex::compute::take::take; | ||
use vortex::serde::context::SerdeContext; | ||
use vortex_error::VortexResult; | ||
use vortex_ipc::iter::FallibleLendingIterator; | ||
use vortex_ipc::reader::StreamReader; | ||
use vortex_ipc::writer::StreamWriter; | ||
|
||
pub fn main() -> VortexResult<()> { | ||
setup_logger(LevelFilter::Error); | ||
|
||
let array = open_vortex(&taxi_data_vortex())?; | ||
println!("Array {}", &array); | ||
|
||
//let ipc = idempotent("ipc.vortex", |path| { | ||
let ipc = "bench-vortex/data/ipc.vortex"; | ||
let mut write = File::create("bench-vortex/data/ipc.vortex")?; | ||
let ctx = SerdeContext::default(); | ||
let mut writer = StreamWriter::try_new(&mut write, ctx)?; | ||
writer.write(&array)?; | ||
//})?; | ||
|
||
// Now try to read from the IPC stream. | ||
let mut read = File::open(ipc)?; | ||
let mut ipc_reader = StreamReader::try_new(&mut read)?; | ||
|
||
// We know we only wrote a single array. | ||
// TODO(ngates): create an option to skip the multi-array reader? | ||
let mut array_reader = ipc_reader.next()?.unwrap(); | ||
println!("DType: {:?}", array_reader.dtype()); | ||
// Read some number of chunks from the stream. | ||
while let Some(chunk) = array_reader.next().unwrap() { | ||
println!("VIEW: {}", (&chunk as &dyn Array)); | ||
let taken = take(&chunk, &PrimitiveArray::from(vec![0, 1, 0, 1])).unwrap(); | ||
println!("Taken: {}", &taken); | ||
} | ||
|
||
Ok(()) | ||
} |
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
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,55 @@ | ||
use flatc::flatc; | ||
use std::env; | ||
use std::ffi::OsStr; | ||
use std::path::{Path, PathBuf}; | ||
use std::process::Command; | ||
|
||
use walkdir::WalkDir; | ||
|
||
fn main() { | ||
let flatbuffers_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()) | ||
.canonicalize() | ||
.expect("Failed to canonicalize CARGO_MANIFEST_DIR") | ||
.join("flatbuffers"); | ||
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()) | ||
.canonicalize() | ||
.expect("Failed to canonicalize OUT_DIR"); | ||
|
||
let fbs_files = WalkDir::new(&flatbuffers_dir) | ||
.into_iter() | ||
.filter_map(|e| e.ok()) | ||
.filter(|e| e.path().extension() == Some(OsStr::new("fbs"))) | ||
.map(|e| { | ||
rerun_if_changed(e.path()); | ||
e.path().to_path_buf() | ||
}) | ||
.collect::<Vec<_>>(); | ||
|
||
if !Command::new(flatc()) | ||
.arg("--rust") | ||
.arg("--filename-suffix") | ||
.arg("") | ||
.arg("-I") | ||
.arg(flatbuffers_dir.join("../../")) | ||
.arg("--include-prefix") | ||
.arg("flatbuffers::deps") | ||
.arg("-o") | ||
.arg(out_dir.join("flatbuffers")) | ||
.args(fbs_files) | ||
.status() | ||
.unwrap() | ||
.success() | ||
{ | ||
panic!("Failed to run flatc"); | ||
} | ||
} | ||
|
||
fn rerun_if_changed(path: &Path) { | ||
println!( | ||
"cargo:rerun-if-changed={}", | ||
path.canonicalize() | ||
.unwrap_or_else(|_| panic!("failed to canonicalize {}", path.to_str().unwrap())) | ||
.to_str() | ||
.unwrap() | ||
); | ||
} |
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
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
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
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
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# pre: false | ||
# features: [] | ||
# all-features: false | ||
# with-sources: false | ||
|
||
-e file:pyvortex | ||
-e file:. |
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
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
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
Oops, something went wrong.