MCPcopy Create free account
hub / github.com/apache/arrow / TypedColumnWriterImpl

Method TypedColumnWriterImpl

cpp/src/parquet/column_writer.cc:1285–1326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1283 using T = typename ParquetType::c_type;
1284
1285 TypedColumnWriterImpl(ColumnChunkMetaDataBuilder* metadata,
1286 std::unique_ptr<PageWriter> pager, const bool use_dictionary,
1287 Encoding::type encoding, const WriterProperties* properties,
1288 BloomFilter* bloom_filter)
1289 : ColumnWriterImpl(metadata, std::move(pager), use_dictionary, encoding,
1290 properties) {
1291 current_encoder_ = MakeEncoder(ParquetType::type_num, encoding, use_dictionary,
1292 descr_, properties->memory_pool());
1293 // We have to dynamic_cast as some compilers don't want to static_cast
1294 // through virtual inheritance.
1295 current_value_encoder_ =
1296 dynamic_cast<TypedEncoder<ParquetType>*>(current_encoder_.get());
1297 // Will be null if not using dictionary, but that's ok
1298 current_dict_encoder_ =
1299 dynamic_cast<DictEncoder<ParquetType>*>(current_encoder_.get());
1300
1301 if (bloom_filter != nullptr) {
1302 bloom_filter_writer_ = std::make_unique<BloomFilterWriter>(descr_, bloom_filter);
1303 }
1304
1305 // GH-46205: Geometry/Geography are the first non-nested logical types to have a
1306 // SortOrder::UNKNOWN. Currently, the presence of statistics is tied to
1307 // having a known sort order and so null counts will be missing.
1308 if (properties->statistics_enabled(descr_->path())) {
1309 if (SortOrder::UNKNOWN != descr_->sort_order()) {
1310 page_statistics_ = MakeStatistics<ParquetType>(descr_, allocator_);
1311 chunk_statistics_ = MakeStatistics<ParquetType>(descr_, allocator_);
1312 }
1313 if (descr_->logical_type() != nullptr && descr_->logical_type()->is_geometry()) {
1314 chunk_geospatial_statistics_ = std::make_shared<geospatial::GeoStatistics>();
1315 }
1316 }
1317
1318 if (properties->size_statistics_level() == SizeStatisticsLevel::ColumnChunk ||
1319 properties->size_statistics_level() == SizeStatisticsLevel::PageAndColumnChunk) {
1320 page_size_statistics_ = SizeStatistics::Make(descr_);
1321 chunk_size_statistics_ = SizeStatistics::Make(descr_);
1322 }
1323 pages_change_on_record_boundaries_ =
1324 properties->data_page_version() == ParquetDataPageVersion::V2 ||
1325 properties->page_index_enabled(descr_->path());
1326 }
1327
1328 int64_t Close() override { return ColumnWriterImpl::Close(); }
1329

Callers

nothing calls this directly

Calls 7

MakeEncoderFunction · 0.85
is_geometryMethod · 0.80
MakeFunction · 0.70
memory_poolMethod · 0.45
getMethod · 0.45
pathMethod · 0.45
sort_orderMethod · 0.45

Tested by

no test coverage detected