jorisvandenbossche commented on a change in pull request #7526: URL: https://github.com/apache/arrow/pull/7526#discussion_r445482607
########## File path: cpp/src/arrow/util/mutex.h ########## @@ -0,0 +1,58 @@ +// 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 <memory> + +#include "arrow/util/macros.h" +#include "arrow/util/visibility.h" + +namespace arrow { +namespace util { + +/// A wrapper around std::mutex since we can't use it directly due to CPP/CLI Review comment: we use `std:mutex` in several places in the code base, so this comment is not fully clear to me ########## File path: cpp/src/arrow/dataset/file_parquet.cc ########## @@ -357,13 +355,20 @@ static inline Result<std::vector<RowGroupInfo>> AugmentRowGroups( return row_groups; } -Result<ScanTaskIterator> ParquetFileFormat::ScanFile( - const FileSource& source, std::shared_ptr<ScanOptions> options, - std::shared_ptr<ScanContext> context, std::vector<RowGroupInfo> row_groups) const { +Result<ScanTaskIterator> ParquetFileFormat::ScanFile(std::shared_ptr<ScanOptions> options, + std::shared_ptr<ScanContext> context, + FileFragment* fragment) const { + const auto& source = fragment->source(); + auto row_groups = checked_cast<const ParquetFileFragment*>(fragment)->row_groups(); + bool row_groups_are_complete = RowGroupInfosAreComplete(row_groups); // The following block is required to avoid any IO if all RowGroups are // excluded due to prior statistics knowledge. if (row_groups_are_complete) { + // physical_schema should be cached at this point + ARROW_ASSIGN_OR_RAISE(auto physical_schema, fragment->ReadPhysicalSchema()); + RETURN_NOT_OK(options->filter->Validate(*physical_schema)); Review comment: To avoid confusion about this, should we rename ReadPhysicalSchema? Or instead of having `ReadPhysicalSchema` which caches and `ReadPhysicalSchemaImpl` that always reads, a `GetPhysicalSchema` that caches and `ReadPhysicalSchema` that reads? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
