You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by "Gang Wu (Jira)" <ji...@apache.org> on 2023/05/12 06:22:00 UTC

[jira] [Assigned] (PARQUET-2299) Use `true` instead of `1` as default value for `is_compressed bool` field

     [ https://issues.apache.org/jira/browse/PARQUET-2299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gang Wu reassigned PARQUET-2299:
--------------------------------

    Assignee: Matthijs Brobbel

> Use `true` instead of `1` as default value for `is_compressed bool` field
> -------------------------------------------------------------------------
>
>                 Key: PARQUET-2299
>                 URL: https://issues.apache.org/jira/browse/PARQUET-2299
>             Project: Parquet
>          Issue Type: Improvement
>          Components: parquet-format
>            Reporter: Matthijs Brobbel
>            Assignee: Matthijs Brobbel
>            Priority: Minor
>             Fix For: format-2.10.0
>
>
> I noticed that the default value for the optional boolean `is_compressed` field of the `DataPageHeaderV2` struct has a default value of `1`. According to the Thrift docs a boolean value is either `true` or `false`. 
> This currently works because the Apache Thrift compiler internally handles bools as ints:
> - https://github.com/apache/thrift/blob/3880a09565a9a1dad028b3679746eafac268c819/compiler/cpp/src/thrift/thriftl.ll#L208-L209
> - https://github.com/apache/thrift/blob/3880a09565a9a1dad028b3679746eafac268c819/compiler/cpp/src/thrift/main.cc#L748
> It may however not work with other Thrift compilers that are more strict about this.
> Based on the docs and a test (https://github.com/apache/thrift/blob/3880a09565a9a1dad028b3679746eafac268c819/test/ThriftTest.thrift#L406) in the Thrift repository it seems that using `true` here is the correct way of defining a default for an optional bool field.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)