diff --git a/cpp/src/arrow/dataset/file_parquet.cc b/cpp/src/arrow/dataset/file_parquet.cc index a3a08e12931c6..e52a6b4882313 100644 --- a/cpp/src/arrow/dataset/file_parquet.cc +++ b/cpp/src/arrow/dataset/file_parquet.cc @@ -421,7 +421,8 @@ std::optional ParquetFileFragment::EvaluateStatisticsAsExpr std::optional ParquetFileFragment::EvaluateStatisticsAsExpression( const Field& field, const parquet::Statistics& statistics) { const auto field_name = field.name(); - return EvaluateStatisticsAsExpression(field, FieldRef(field_name), statistics); + return EvaluateStatisticsAsExpression(field, FieldRef(std::move(field_name)), + statistics); } ParquetFileFormat::ParquetFileFormat() @@ -902,11 +903,11 @@ Result> ParquetFileFragment::TestRowGroups( return std::vector{}; } - const SchemaField* schema_field = nullptr; for (const FieldRef& ref : FieldsInExpression(predicate)) { ARROW_ASSIGN_OR_RAISE(auto match, ref.FindOneOrNone(*physical_schema_)); + if (match.empty()) continue; - schema_field = &manifest_->schema_fields[match[0]]; + const SchemaField* schema_field = &manifest_->schema_fields[match[0]]; for (size_t i = 1; i < match.indices().size(); ++i) { if (schema_field->field->type()->id() != Type::STRUCT) {