You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/28 11:27:39 UTC

[GitHub] [arrow-rs] alamb commented on a change in pull request #721: Fix decimal repr in parquet schema printer

alamb commented on a change in pull request #721:
URL: https://github.com/apache/arrow-rs/pull/721#discussion_r697856873



##########
File path: parquet/src/schema/printer.rs
##########
@@ -630,6 +633,20 @@ mod tests {
                 .unwrap(),
                 "REPEATED FIXED_LEN_BYTE_ARRAY (14) decimal (DECIMAL(32,20));",
             ),
+            (
+                Type::primitive_type_builder(
+                    "decimal",
+                    PhysicalType::FIXED_LEN_BYTE_ARRAY,
+                )
+                .with_converted_type(ConvertedType::DECIMAL)
+                .with_precision(19)
+                .with_scale(4)
+                .with_length(decimal_length_from_precision(19))
+                .with_repetition(Repetition::OPTIONAL)
+                .build()
+                .unwrap(),
+                "OPTIONAL FIXED_LEN_BYTE_ARRAY (9) decimal (DECIMAL(19,4));",

Review comment:
       In case anyone is interested, I double checked that test fails  without the code change in this PR (unsurprisingly):
   
   ```
   
   ---- schema::printer::tests::test_print_flba_logical_types stdout ----
   thread 'schema::printer::tests::test_print_flba_logical_types' panicked at 'called `Result::unwrap()` on an `Err` value: General("Cannot represent FIXED_LEN_BYTE_ARRAY as DECIMAL with length 8 and precision 19. The max precision can only be 18")', parquet/src/schema/printer.rs:644:18
   ```




-- 
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