Skip to content

Commit

Permalink
feature gate csv functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed May 17, 2021
1 parent c863a2c commit b3049b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ serde_derive = "1.0"
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "1.6"
rand = "0.7"
csv = "1.1"
num = "0.4"
csv_crate = { version = "1.1", optional = true, package="csv" }
num = "0.3"
regex = "1.3"
lazy_static = "1.4"
packed_simd = { version = "0.3.4", optional = true, package = "packed_simd_2" }
Expand All @@ -54,8 +55,9 @@ lexical-core = "^0.7"
multiversion = "0.6.1"

[features]
default = []
default = ["csv"]
avx512 = []
csv = ["csv_crate"]
simd = ["packed_simd"]
prettyprint = ["prettytable-rs"]
# this is only intended to be used in single-threaded programs: it verifies that
Expand Down
2 changes: 1 addition & 1 deletion arrow/src/csv/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use std::sync::Arc;

use csv as csv_crate;
use csv_crate;

use crate::array::{
ArrayRef, BooleanArray, DictionaryArray, PrimitiveArray, StringArray,
Expand Down
2 changes: 1 addition & 1 deletion arrow/src/csv/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
//! }
//! ```
use csv as csv_crate;
use csv_crate;

use std::io::Write;

Expand Down
4 changes: 3 additions & 1 deletion arrow/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
use std::fmt::{Debug, Display, Formatter};
use std::io::Write;

use csv as csv_crate;
#[cfg(feature = "csv")]
use csv_crate;
use std::error::Error;

/// Many different operations in the `arrow` crate return this error type.
Expand Down Expand Up @@ -59,6 +60,7 @@ impl From<::std::io::Error> for ArrowError {
}
}

#[cfg(feature = "csv")]
impl From<csv_crate::Error> for ArrowError {
fn from(error: csv_crate::Error) -> Self {
match error.kind() {
Expand Down
1 change: 1 addition & 0 deletions arrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub mod bitmap;
pub mod buffer;
mod bytes;
pub mod compute;
#[cfg(feature = "csv")]
pub mod csv;
pub mod datatypes;
pub mod error;
Expand Down

0 comments on commit b3049b1

Please sign in to comment.