You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/10/09 14:24:07 UTC

[GitHub] [arrow] bkietz commented on a change in pull request #8301: ARROW-10100: [C++][Python][Dataset] Add ParquetFileFragment::Subset method

bkietz commented on a change in pull request #8301:
URL: https://github.com/apache/arrow/pull/8301#discussion_r502461050



##########
File path: cpp/src/arrow/dataset/file_parquet.cc
##########
@@ -631,6 +631,39 @@ Result<FragmentVector> ParquetFileFragment::SplitByRowGroup(
   return fragments;
 }
 
+Result<std::shared_ptr<Fragment>> ParquetFileFragment::Subset(
+    const std::shared_ptr<Expression>& predicate) {
+  RETURN_NOT_OK(EnsureCompleteMetadata());
+  ARROW_ASSIGN_OR_RAISE(auto row_groups, FilterRowGroups(*predicate));
+
+  ARROW_ASSIGN_OR_RAISE(auto new_fragment,
+                        parquet_format_.MakeFragment(source_, partition_expression(),
+                                                     row_groups, physical_schema_));
+  return new_fragment;

Review comment:
       ```suggestion
     return checked_pointer_cast<ParquetFileFragment>(std::move(new_fragment));
   ```

##########
File path: cpp/src/arrow/dataset/file_parquet.h
##########
@@ -232,6 +232,10 @@ class ARROW_DS_EXPORT ParquetFileFragment : public FileFragment {
   /// \brief Ensure attached statistics are complete and the physical schema is cached.
   Status EnsureCompleteMetadata(parquet::arrow::FileReader* reader = NULLPTR);
 
+  /// \brief Return a filtered subset of the ParquetFileFragment.
+  Result<std::shared_ptr<Fragment>> Subset(const std::shared_ptr<Expression>& predicate);
+  Result<std::shared_ptr<Fragment>> Subset(const std::vector<int> row_group_ids);

Review comment:
       ```suggestion
     Result<std::shared_ptr<ParquetFileFragment>> Subset(const std::shared_ptr<Expression>& predicate);
     Result<std::shared_ptr<ParquetFileFragment>> Subset(const std::vector<int> row_group_ids);
   ```




----------------------------------------------------------------
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:
users@infra.apache.org