You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "eddyxu (via GitHub)" <gi...@apache.org> on 2023/03/10 05:54:50 UTC

[GitHub] [arrow-rs] eddyxu opened a new issue, #3837: Concating dictionary array leads to duplicated dict values.

eddyxu opened a new issue, #3837:
URL: https://github.com/apache/arrow-rs/issues/3837

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   I was trying to concatenate a few DictionaryArrays using `arrow_select::concat::concat`. While the each Dictionary Array shares the same value strings. The resulted array however have all values from each DictionaryArray copied (duplicated) in the final output. 
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   ```rust
   let arrs: Vec<Arc<DictionaryArray<Int32Type>>> = (0..10).map(|v| {
             let mut dict_builder = StringDictionaryBuilder::<Int32Type>::new();
             dict_builder.append_null();
             dict_builder.append("a").unwrap();
             dict_builder.append("b").unwrap();
             dict_builder.append("c").unwrap();
             Arc::new(dict_builder.finish())
       }).collect();
       let mut arrays: Vec<&dyn Array> = vec![];
       for b in arrs.iter() {
           arrays.push(b.as_ref());
       }
       let b = concat(arrays.as_slice()).unwrap();
       println!("Batch is: {:?}", b);
   ```
   
   Output
   ```
   Batch is: DictionaryArray {keys: PrimitiveArray<Int32>
   [
     null,
     0,
     1,
     2,
     null,
     3,
     4,
     5,
   ] values: StringArray
   [
     "a",
     "b",
     "c",
     "a",
     "b",
     "c",
   ]}
   
   ```
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   I'd expect the output will be
   
   ```
   DictionaryArray {keys: PrimitiveArray<Int32>
   [
     null,
     0,
     1,
     2,
     null,
     0,
     1,
      2
   ] values: StringArray
   [
     "a",
     "b",
     "c",
   ]}
   ```
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   
   N/A


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold commented on issue #3837: Concating dictionary array leads to duplicated dict values.

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #3837:
URL: https://github.com/apache/arrow-rs/issues/3837#issuecomment-1463598082

   This is intentional, #506 tracks doing something different here


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold closed issue #3837: Concating dictionary array leads to duplicated dict values.

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #3837: Concating dictionary array leads to duplicated dict values.
URL: https://github.com/apache/arrow-rs/issues/3837


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org