pitrou commented on code in PR #40594: URL: https://github.com/apache/arrow/pull/40594#discussion_r1842427317
########## cpp/src/parquet/size_statistics.h: ########## @@ -0,0 +1,160 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <optional> + +#include "parquet/platform.h" + +namespace parquet { + +struct ByteArray; +class ColumnDescriptor; + +/// \brief SizeStatistics is a proxy around format::SizeStatistics. +/// +/// A structure for capturing metadata for estimating the unencoded, +/// uncompressed size of data written. This is useful for readers to estimate +/// how much memory is needed to reconstruct data in their memory model and for +/// fine-grained filter push down on nested structures (the histograms contained +/// in this structure can help determine the number of nulls at a particular +/// nesting level and maximum length of lists). +class PARQUET_EXPORT SizeStatistics { + public: + /// \brief API convenience to get a SizeStatistics accessor + /// + /// \param size_statistics pointer to the thrift SizeStatistics structure. + /// \param descr column descriptor for the column. + /// \returns SizeStatistics object. Its lifetime is not bound to the input. + static std::unique_ptr<SizeStatistics> Make(const void* size_statistics, Review Comment: > Returning a subclass requires implementing virtual functions, which will be called frequently at every batch. This is something I want to avoid. What do you mean, frequently? (ideally this would be a simple struct: ```c++ struct SizeStatistics { std::optional<int64_t> unencoded_byte_array_data_bytes; std::vector<int64_t> definition_level_histogram; std::vector<int64_t> repetition_level_histogram; }; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org