Skip to content

Commit

Permalink
Minor refactor and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefffrey committed Mar 23, 2024
1 parent 7f66552 commit 70a0262
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/arrow_reader/decoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ impl<T: ArrowPrimitiveType> PrimitiveArrayDecoder<T> {
) -> Result<PrimitiveArray<T>> {
let present = derive_present_vec(&mut self.present, parent_present, batch_size);

match &present {
match present {
Some(present) => {
let mut builder = PrimitiveBuilder::<T>::with_capacity(batch_size);
for &is_present in present {
for is_present in present {
if is_present {
// TODO: return as error instead
let val = self
Expand Down Expand Up @@ -128,10 +128,10 @@ impl ArrayBatchDecoder for BooleanArrayDecoder {
) -> Result<ArrayRef> {
let present = derive_present_vec(&mut self.present, parent_present, batch_size);

match &present {
match present {
Some(present) => {
let mut builder = BooleanBuilder::with_capacity(batch_size);
for &is_present in present {
for is_present in present {
if is_present {
// TODO: return as error instead
let val = self
Expand Down
6 changes: 6 additions & 0 deletions src/arrow_reader/decoder/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ impl ArrayBatchDecoder for DictionaryStringArrayDecoder {
let keys = self
.indexes
.next_primitive_batch(batch_size, parent_present)?;
// TODO: ORC spec states: For dictionary encodings the dictionary is sorted
// (in lexicographical order of bytes in the UTF-8 encodings).
// So we can set the is_ordered property here?
let array = DictionaryArray::try_new(keys, self.dictionary.clone()).context(ArrowSnafu)?;
// Cast back to StringArray to ensure all stripes have consistent datatype
// TODO: Is there anyway to preserve the dictionary encoding?
// This costs performance.
let array = cast(&array, &DataType::Utf8).context(ArrowSnafu)?;

let array = Arc::new(array);
Expand Down

0 comments on commit 70a0262

Please sign in to comment.