[
https://issues.apache.org/jira/browse/AVRO-3780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732482#comment-17732482
]
ASF subversion and git services commented on AVRO-3780:
-------------------------------------------------------
Commit ffa145c9ab4d8b4600406f82dd52427a61eb5aed in avro's branch
refs/heads/branch-1.11 from theo
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=ffa145c9a ]
AVRO-3780: [Rust] Bug: decimal logical type usage through Fixed (#2283)
* feat: add failing test case
* AVRO-3780: Fix parsing of `decimal` logical schema with `fixed`
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
---------
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
Co-authored-by: Fedor Telnov <[email protected]>
Co-authored-by: Martin Tzvetanov Grigorov <[email protected]>
(cherry picked from commit 12d0655adaf232b82b4ca529ee985508950049d1)
> [Rust] Bug: decimal logical type usage through Fixed
> ----------------------------------------------------
>
> Key: AVRO-3780
> URL: https://issues.apache.org/jira/browse/AVRO-3780
> Project: Apache Avro
> Issue Type: Bug
> Components: rust
> Reporter: Fedor Telnov
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently, fixed type almost could not be used to represent decimal logical
> type.
> What am I trying to do is to parse such a schema:
> {code:json}
> {
> "type": "record",
> "name": "recordWithDecimal",
> "fields": [
> {
> "name": "decimal",
> "type": {
> "type": "fixed", "name": "nestedFixed", "size": 8,
> "logicalType": "decimal", "precision": 4
> }
> }
> ],
> }
> {code}
> It must be working if we strictly follow the avro specs. It does not work on
> master - you can see it through the test I supplied in the attached PR.
> Interestingly, such a thing works with bytes, so following schema works great:
> {code:json}
> {
> "type": "record",
> "name": "recordWithDecimal",
> "fields": [
> {
> "name": "decimal",
> "type":
> { "type": "bytes", "name": "nestedFixed", "logicalType":
> "decimal", "precision": 4 }
> }
> ],
> }
> {code}
> And the only existing workaround is to extract decimal attributes to the
> field declaration, like so:
> {code:json}
> {
> "name": "decimal",
> "type":
> { "type": "fixed", "name": "nestedFixed" },
> "size": 8,
> "logicalType": "decimal",
> "precision": 4
> }
> {code}
> Such a workaround should not be treated as an acceptable variant as it does
> not follow avro specification at all(I think, such a syntax is an extension,
> introduced in the Rust crate - correct me if I'm wrong).
>
> I haven't investigated the roots yet, so any thoughts are welcome before I do
> it myself.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)