This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
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
2c4dbb2
commit 6805821
Showing
30 changed files
with
617 additions
and
418 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,26 @@ | ||
use std::fmt::{Debug, Formatter, Result, Write}; | ||
|
||
use super::super::fmt::write_vec; | ||
use super::super::Offset; | ||
use super::BinaryArray; | ||
|
||
pub fn write_value<O: Offset, W: Write>(array: &BinaryArray<O>, index: usize, f: &mut W) -> Result { | ||
let bytes = array.value(index); | ||
let writer = |f: &mut W, index| write!(f, "{}", bytes[index]); | ||
|
||
write_vec(f, writer, None, bytes.len(), "None", false) | ||
} | ||
|
||
impl<O: Offset> Debug for BinaryArray<O> { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> Result { | ||
let writer = |f: &mut Formatter, index| write_value(self, index, f); | ||
|
||
let head = if O::is_large() { | ||
"LargeBinaryArray" | ||
} else { | ||
"BinaryArray" | ||
}; | ||
write!(f, "{}", head)?; | ||
write_vec(f, writer, self.validity(), self.len(), "None", false) | ||
} | ||
} |
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,17 @@ | ||
use std::fmt::{Debug, Formatter, Result, Write}; | ||
|
||
use super::super::fmt::write_vec; | ||
use super::BooleanArray; | ||
|
||
pub fn write_value<W: Write>(array: &BooleanArray, index: usize, f: &mut W) -> Result { | ||
write!(f, "{}", array.value(index)) | ||
} | ||
|
||
impl Debug for BooleanArray { | ||
fn fmt(&self, f: &mut Formatter) -> Result { | ||
let writer = |f: &mut Formatter, index| write_value(self, index, f); | ||
|
||
write!(f, "BooleanArray")?; | ||
write_vec(f, writer, self.validity(), self.len(), "None", false) | ||
} | ||
} |
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,32 @@ | ||
use std::fmt::{Debug, Formatter, Result, Write}; | ||
|
||
use crate::array::Array; | ||
|
||
use super::super::fmt::{get_display, write_vec}; | ||
use super::{DictionaryArray, DictionaryKey}; | ||
|
||
pub fn write_value<K: DictionaryKey, W: Write>( | ||
array: &DictionaryArray<K>, | ||
index: usize, | ||
null: &'static str, | ||
f: &mut W, | ||
) -> Result { | ||
let keys = array.keys(); | ||
let values = array.values(); | ||
|
||
if keys.is_valid(index) { | ||
let key = keys.value(index).to_usize().unwrap(); | ||
get_display(values.as_ref(), null)(f, key) | ||
} else { | ||
write!(f, "{}", null) | ||
} | ||
} | ||
|
||
impl<K: DictionaryKey> Debug for DictionaryArray<K> { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> Result { | ||
let writer = |f: &mut Formatter, index| write_value(self, index, "None", f); | ||
|
||
write!(f, "DictionaryArray")?; | ||
write_vec(f, writer, self.validity(), self.len(), "None", false) | ||
} | ||
} |
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.