Skip to content

Commit c17fa00

Browse files
committed
fixed a bug in boolean in JSON
1 parent ecf07af commit c17fa00

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "verticareader"
3-
version = "1.8.0"
3+
version = "1.8.1"
44
authors = ["Joey Gibson <joey@joeygibson.com>"]
55
edition = "2018"
66
description = "A program to read Vertica native binary files and convert them to CSV."

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ mod tests {
525525

526526
assert_eq!(contents[0]["IntCol"].as_i64().unwrap(), 1);
527527
assert_eq!(contents[0]["The_Date"].as_str().unwrap(), "1999-01-08");
528+
assert_eq!(contents[0]["Bools"].as_bool().unwrap(), true);
528529
});
529530

530531
match fs::remove_file(Path::new(&output_file_name)) {
@@ -661,6 +662,7 @@ mod tests {
661662

662663
assert_eq!(contents["IntCol"].as_i64().unwrap(), 1);
663664
assert_eq!(contents["The_Date"].as_str().unwrap(), "1999-01-08");
665+
assert_eq!(contents["Bools"].as_bool().unwrap(), true);
664666
});
665667

666668
match fs::remove_file(Path::new(&output_file_name)) {
@@ -757,6 +759,7 @@ mod tests {
757759
assert_eq!(contents.len(), 5_usize);
758760
assert_eq!(contents[0]["IntCol"].as_i64().unwrap(), 1);
759761
assert_eq!(contents[0]["The_Date"].as_str().unwrap(), "1999-01-08");
762+
assert_eq!(contents[0]["Bools"].as_bool().unwrap(), true);
760763
});
761764

762765
match fs::remove_file(Path::new(&output_file_name)) {
@@ -801,6 +804,7 @@ mod tests {
801804
assert_eq!(contents.as_array().unwrap().len(), 5_usize);
802805
assert_eq!(contents[0]["IntCol"].as_i64().unwrap(), 1);
803806
assert_eq!(contents[0]["The_Date"].as_str().unwrap(), "1999-01-08");
807+
assert_eq!(contents[0]["Bools"].as_bool().unwrap(), true);
804808
});
805809

806810
match fs::remove_file(Path::new(&output_file_name)) {

src/vertica_native_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl Row {
218218
| ColumnType::Binary
219219
| ColumnType::Interval
220220
| ColumnType::UUID => Value::String(value),
221-
ColumnType::Boolean => Value::Bool(value == "true"),
221+
ColumnType::Boolean => Value::Bool(value == "1"),
222222
};
223223

224224
record.insert(name, mapped_value);

0 commit comments

Comments
 (0)