Skip to content

Commit a7fc11e

Browse files
committed
Move initialization logic out of header
1 parent 0552b66 commit a7fc11e

File tree

2 files changed

+47
-41
lines changed

2 files changed

+47
-41
lines changed

cpp/src/parquet/properties.cc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,48 @@ std::shared_ptr<ArrowWriterProperties> default_arrow_writer_properties() {
6767
return default_writer_properties;
6868
}
6969

70+
void WriterProperties::Builder::CopyColumnSpecificProperties(
71+
const WriterProperties& properties) {
72+
for (const auto& [col_path, col_props] : properties.column_properties_) {
73+
if (col_props.statistics_enabled() !=
74+
default_column_properties_.statistics_enabled()) {
75+
if (col_props.statistics_enabled()) {
76+
this->enable_statistics(col_path);
77+
} else {
78+
this->disable_statistics(col_path);
79+
}
80+
}
81+
82+
if (col_props.dictionary_enabled() !=
83+
default_column_properties_.dictionary_enabled()) {
84+
if (col_props.dictionary_enabled()) {
85+
this->enable_dictionary(col_path);
86+
} else {
87+
this->disable_dictionary(col_path);
88+
}
89+
}
90+
91+
if (col_props.page_index_enabled() !=
92+
default_column_properties_.page_index_enabled()) {
93+
if (col_props.page_index_enabled()) {
94+
this->enable_write_page_index(col_path);
95+
} else {
96+
this->disable_write_page_index(col_path);
97+
}
98+
}
99+
100+
if (col_props.compression() != default_column_properties_.compression()) {
101+
this->compression(col_path, col_props.compression());
102+
}
103+
104+
if (col_props.compression_level() != default_column_properties_.compression_level()) {
105+
this->compression_level(col_path, col_props.compression_level());
106+
}
107+
108+
if (col_props.encoding() != default_column_properties_.encoding()) {
109+
this->encoding(col_path, col_props.encoding());
110+
}
111+
}
112+
}
113+
70114
} // namespace parquet

cpp/src/parquet/properties.h

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -323,47 +323,7 @@ class PARQUET_EXPORT WriterProperties {
323323
properties.content_defined_chunking_enabled()),
324324
content_defined_chunking_options_(
325325
properties.content_defined_chunking_options()) {
326-
for (const auto& [col_path, col_props] : properties.column_properties_) {
327-
if (col_props.statistics_enabled() !=
328-
default_column_properties_.statistics_enabled()) {
329-
if (col_props.statistics_enabled()) {
330-
this->enable_statistics(col_path);
331-
} else {
332-
this->disable_statistics(col_path);
333-
}
334-
}
335-
336-
if (col_props.dictionary_enabled() !=
337-
default_column_properties_.dictionary_enabled()) {
338-
if (col_props.dictionary_enabled()) {
339-
this->enable_dictionary(col_path);
340-
} else {
341-
this->disable_dictionary(col_path);
342-
}
343-
}
344-
345-
if (col_props.page_index_enabled() !=
346-
default_column_properties_.page_index_enabled()) {
347-
if (col_props.page_index_enabled()) {
348-
this->enable_write_page_index(col_path);
349-
} else {
350-
this->disable_write_page_index(col_path);
351-
}
352-
}
353-
354-
if (col_props.compression() != default_column_properties_.compression()) {
355-
this->compression(col_path, col_props.compression());
356-
}
357-
358-
if (col_props.compression_level() !=
359-
default_column_properties_.compression_level()) {
360-
this->compression_level(col_path, col_props.compression_level());
361-
}
362-
363-
if (col_props.encoding() != default_column_properties_.encoding()) {
364-
this->encoding(col_path, col_props.encoding());
365-
}
366-
}
326+
CopyColumnSpecificProperties(properties);
367327
}
368328

369329
/// \brief EXPERIMENTAL: Use content-defined page chunking for all columns.
@@ -826,6 +786,8 @@ class PARQUET_EXPORT WriterProperties {
826786
}
827787

828788
private:
789+
void CopyColumnSpecificProperties(const WriterProperties& properties);
790+
829791
MemoryPool* pool_;
830792
int64_t dictionary_pagesize_limit_;
831793
int64_t write_batch_size_;

0 commit comments

Comments
 (0)