wgtmac commented on code in PR #624: URL: https://github.com/apache/iceberg-cpp/pull/624#discussion_r3309201043
########## src/iceberg/puffin/puffin_reader.h: ########## @@ -0,0 +1,85 @@ +/* + * 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 + +/// \file iceberg/puffin/puffin_reader.h +/// Puffin file reader. + +#include <cstddef> +#include <cstdint> +#include <memory> +#include <optional> +#include <utility> +#include <vector> + +#include "iceberg/iceberg_data_export.h" +#include "iceberg/puffin/file_metadata.h" +#include "iceberg/result.h" + +namespace iceberg { +class InputFile; +class SeekableInputStream; +} // namespace iceberg + +namespace iceberg::puffin { + +/// \brief Reader for Puffin files. +/// +/// Reads from an InputFile with seek support for efficient blob access. +class ICEBERG_DATA_EXPORT PuffinReader { + public: + /// \brief Create a PuffinReader for the given input file. + /// \param input_file The input file to read from. + /// \param footer_size Optional known footer size hint to avoid an extra seek. + static Result<std::unique_ptr<PuffinReader>> Make( + std::unique_ptr<InputFile> input_file, + std::optional<int64_t> footer_size = std::nullopt); + + ~PuffinReader(); Review Comment: Java PuffinReader.close() closes the input stream. This reader owns a SeekableInputStream whose interface has an explicit Close() contract, but PuffinReader exposes no Close() and its destructor is defaulted, so readers can leak or delay releasing file handles/object-store resources. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
