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

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

Matthijs Brobbel created PARQUET-2299:
-----------------------------------------

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


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)