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

Method TypedColumnWriterImpl

cpp/src/parquet/column_writer.cc:1286–1327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected