You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "phillipleblanc (via GitHub)" <gi...@apache.org> on 2024/10/21 02:39:38 UTC
[I] Implement arrow_json encoder for Decimal128 & Decimal256 DataTypes [arrow-rs]
phillipleblanc opened a new issue, #6605:
URL: https://github.com/apache/arrow-rs/issues/6605
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
I would like to be able to use the arrow_json::ArrayWriter to write Arrow batches that contain Decimal128 & Decimal256 data.
**Describe the solution you'd like**
Running this code does not produce an error:
```rust
#[test]
fn test_decimal128_encoder() {
let array = Decimal128Array::from_iter_values([1234, 5678, 9012])
.with_precision_and_scale(10, 2)
.unwrap();
let field = Arc::new(Field::new("decimal", array.data_type().clone(), true));
let schema = Schema::new(vec![field]);
let batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(array)]).unwrap();
let mut buf = Vec::new();
{
let mut writer = LineDelimitedWriter::new(&mut buf);
writer.write_batches(&[&batch]).unwrap();
}
assert_json_eq(
&buf,
r#"{"decimal":12.34}
{"decimal":56.78}
{"decimal":90.12}
"#,
);
}
```
**Describe alternatives you've considered**
N/A
**Additional context**
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
Re: [I] Implement arrow_json encoder for Decimal128 & Decimal256 DataTypes [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #6605: Implement arrow_json encoder for Decimal128 & Decimal256 DataTypes
URL: https://github.com/apache/arrow-rs/issues/6605
--
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
Re: [I] Implement arrow_json encoder for Decimal128 & Decimal256 DataTypes [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6605:
URL: https://github.com/apache/arrow-rs/issues/6605#issuecomment-2427364877
`label_issue.py` automatically added labels {'arrow'} from #6606
--
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