Repository: apache/arrow
File: cpp/src/parquet/properties.h (C/C++)

Code before:
          store_decimal_as_integer_(false),
          page_checksum_enabled_(false),
          size_statistics_level_(DEFAULT_SIZE_STATISTICS_LEVEL),
          content_defined_chunking_enabled_(false),
          content_defined_chunking_options_({}) {}

    explicit Builder(const WriterProperties& properties)
        : pool_(properties.memory_pool()),
          dictionary_pagesize_limit_(properties.dictionary_pagesize_limit()),
          write_batch_size_(properties.write_batch_size()),
          max_row_group_length_(properties.max_row_group_length()),
          pagesize_(properties.data_pagesize()),
          max_rows_per_page_(properties.max_rows_per_page()),
          version_(properties.version()),
          data_page_version_(properties.data_page_version()),
          created_by_(properties.created_by()),
          store_decimal_as_integer_(properties.store_decimal_as_integer()),
          page_checksum_enabled_(properties.page_checksum_enabled()),
          size_statistics_level_(properties.size_statistics_level()),
          sorting_columns_(properties.sorting_columns()),
          default_column_properties_(properties.default_column_properties()),
          content_defined_chunking_enabled_(
              properties.content_defined_chunking_enabled()),
          content_defined_chunking_options_(
              properties.content_defined_chunking_options()) {
      for (const auto& [col_path, col_props] : properties.column_properties_) {
        if (col_props.statistics_enabled() !=
            default_column_properties_.statistics_enabled()) {
          if (col_props.statistics_enabled()) {
            this->enable_statistics(col_path);
          } else {
            this->disable_statistics(col_path);
          }
        }

        if (col_props.dictionary_enabled() !=
            default_column_properties_.dictionary_enabled()) {
          if (col_props.dictionary_enabled()) {
            this->enable_dictionary(col_path);
          } else {
            this->disable_dictionary(col_path);
          }
        }

        if (col_props.page_index_enabled() !=
            default_column_properties_.page_index_enabled()) {
          if (col_props.page_index_enabled()) {
            this->enable_write_page_index(col_path);
          } else {
            this->disable_write_page_index(col_path);
          }

Review comment (refactor):
I just noticed that `WriterProperties` and `WriterProperties::Builder` use different forms to represent column properties. Is it possible to simplify this by using the same form?

Code after:
          store_decimal_as_integer_(false),
          page_checksum_enabled_(false),
          size_statistics_level_(DEFAULT_SIZE_STATISTICS_LEVEL),
          content_defined_chunking_enabled_(false),
          content_defined_chunking_options_({}) {}

    explicit Builder(const WriterProperties& properties)
        : pool_(properties.memory_pool()),
          dictionary_pagesize_limit_(properties.dictionary_pagesize_limit()),
          write_batch_size_(properties.write_batch_size()),
          max_row_group_length_(properties.max_row_group_length()),
          pagesize_(properties.data_pagesize()),
          max_rows_per_page_(properties.max_rows_per_page()),
          version_(properties.version()),
          data_page_version_(properties.data_page_version()),
          created_by_(properties.created_by()),
          store_decimal_as_integer_(properties.store_decimal_as_integer()),
          page_checksum_enabled_(properties.page_checksum_enabled()),
          size_statistics_level_(properties.size_statistics_level()),
          sorting_columns_(properties.sorting_columns()),
          default_column_properties_(properties.default_column_properties()),
          content_defined_chunking_enabled_(
              properties.content_defined_chunking_enabled()),
          content_defined_chunking_options_(
              properties.content_defined_chunking_options()) {
      CopyColumnSpecificProperties(properties);
    }

    /// \brief EXPERIMENTAL: Use content-defined page chunking for all columns.
    ///
    /// Optimize parquet files for content addressable storage (CAS) systems by writing
    /// data pages according to content-defined chunk boundaries. This allows for more
    /// efficient deduplication of data across files, hence more efficient network
    /// transfers and storage. The chunking is based on a rolling hash algorithm that
    /// identifies chunk boundaries based on the actual content of the data.
    ///
    /// Note that only the WriteArrow() interface is supported at the moment.
    Builder* enable_content_defined_chunking() {
      content_defined_chunking_enabled_ = true;
      return this;
    }

    /// \brief EXPERIMENTAL: Disable content-defined page chunking for all columns.
    Builder* disable_content_defined_chunking() {
      content_defined_chunking_enabled_ = false;
      return this;
    }

    /// \brief EXPERIMENTAL: Specify content-defined chunking options, see CdcOptions.
    Builder* content_defined_chunking_options(const CdcOptions& options) {
      content_defined_chunking_options_ = options;