-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
26 changed files
with
3,883 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
/Cargo.lock |
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,17 @@ | ||
[package] | ||
name = "orc-rs" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
arrow = "42.0.0" | ||
bytes = "1.4" | ||
chrono = "0.4.26" | ||
flate2 = "1" | ||
fallible-streaming-iterator = { version = "0.1" } | ||
paste = "1.0.12" | ||
prost = { version = "0.11.9" } | ||
lazy_static = "1.4.0" | ||
snafu = "0.7.4" |
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,8 @@ | ||
.PHONY: fmt | ||
fmt: ## Format all the Rust code. | ||
cargo fmt --all | ||
|
||
|
||
.PHONY: clippy | ||
clippy: ## Check clippy rules. | ||
cargo clippy --workspace --all-targets -- -D warnings |
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,2 @@ | ||
group_imports = "StdExternalCrate" | ||
imports_granularity = "Module" |
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,79 @@ | ||
use std::str::Utf8Error; | ||
|
||
use arrow::error::ArrowError; | ||
pub use snafu::prelude::*; | ||
use snafu::Location; | ||
|
||
use crate::proto::r#type::Kind; | ||
|
||
#[derive(Debug, Snafu)] | ||
#[snafu(visibility(pub))] | ||
pub enum Error { | ||
#[snafu(display("Failed to seek, source: {}", source))] | ||
SeekError { | ||
source: std::io::Error, | ||
location: Location, | ||
}, | ||
|
||
#[snafu(display("Failed to read, source: {}", source))] | ||
IoError { | ||
source: std::io::Error, | ||
location: Location, | ||
}, | ||
|
||
#[snafu(display("Invalid input, message: {}", msg))] | ||
InvalidInput { msg: String, location: Location }, | ||
|
||
#[snafu(display("Out of sepc, message: {}", msg))] | ||
OutOfSpec { msg: String, location: Location }, | ||
|
||
#[snafu(display("Failed to decode float, source: {}", source))] | ||
DecodeFloat { | ||
location: Location, | ||
source: std::io::Error, | ||
}, | ||
|
||
#[snafu(display("Failed to decode proto, source: {}", source))] | ||
DecodeProto { | ||
location: Location, | ||
source: prost::DecodeError, | ||
}, | ||
|
||
#[snafu(display("No types found"))] | ||
NoTypes { location: Location }, | ||
|
||
#[snafu(display("unsupported type: {:?}", kind))] | ||
UnsupportedType { location: Location, kind: Kind }, | ||
|
||
#[snafu(display("Field not found: {:?}", name))] | ||
FieldNotFOund { location: Location, name: String }, | ||
|
||
#[snafu(display("Invalid column : {:?}", name))] | ||
InvalidColumn { location: Location, name: String }, | ||
|
||
#[snafu(display("Failed to convert to timestamp"))] | ||
InvalidTimestamp { location: Location }, | ||
|
||
#[snafu(display("Failed to convert to date"))] | ||
InvalidDate { location: Location }, | ||
|
||
#[snafu(display("Failed to add day to a date"))] | ||
AddDays { location: Location }, | ||
|
||
#[snafu(display("Invalid utf8, source: {}", source))] | ||
InvalidUft8 { | ||
location: Location, | ||
source: Utf8Error, | ||
}, | ||
|
||
#[snafu(display("Out of bound at: {}", index))] | ||
OutOfBound { location: Location, index: usize }, | ||
|
||
#[snafu(display("Failed to convert to record batch: {}", source))] | ||
ConvertRecordBatch { | ||
location: Location, | ||
source: ArrowError, | ||
}, | ||
} | ||
|
||
pub type Result<T> = std::result::Result<T, Error>; |
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,23 @@ | ||
#![feature(trait_upcasting)] | ||
#![allow(incomplete_features)] | ||
#![feature(iterator_try_collect)] | ||
#![feature(iter_next_chunk)] | ||
|
||
pub mod error; | ||
pub mod proto; | ||
pub mod reader; | ||
|
||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
Oops, something went wrong.