westonpace commented on a change in pull request #10124:
URL: https://github.com/apache/arrow/pull/10124#discussion_r617720845



##########
File path: cpp/src/arrow/dataset/test_util.h
##########
@@ -119,6 +119,23 @@ void EnsureRecordBatchReaderDrained(RecordBatchReader* 
reader) {
   EXPECT_EQ(batch, nullptr);
 }
 
+/// Test dataset that returns one or more fragments.
+class FragmentDataset : public Dataset {
+ public:
+  FragmentDataset(std::shared_ptr<Schema> schema, FragmentVector fragments)
+      : Dataset(schema), fragments_(std::move(fragments)) {}

Review comment:
       Nit: Could probably be `Dataset(std::move(schema))`

##########
File path: cpp/src/arrow/dataset/scanner_test.cc
##########
@@ -71,6 +71,14 @@ std::ostream& operator<<(std::ostream& out, const 
TestScannerParams& params) {
 
 class TestScanner : public DatasetFixtureMixinWithParam<TestScannerParams> {
  protected:
+  std::shared_ptr<Scanner> MakeScanner(std::shared_ptr<Dataset> dataset) {
+    ScannerBuilder builder(dataset, options_);

Review comment:
       Nit: could be `std::move(dataset)`

##########
File path: cpp/src/arrow/dataset/scanner_test.cc
##########
@@ -319,6 +322,23 @@ class FailingFragment : public InMemoryFragment {
       return std::make_shared<InMemoryScanTask>(batches, options, self);
     });
   }
+
+  Result<RecordBatchGenerator> ScanBatchesAsync(
+      const std::shared_ptr<ScanOptions>& options) override {
+    struct {
+      Future<std::shared_ptr<RecordBatch>> operator()() {
+        if (index > 16) {
+          return Status::Invalid("Oh no, we failed!");
+        }
+        auto batch = batches[index++ % batches.size()];
+        return Future<std::shared_ptr<RecordBatch>>::MakeFinished(batch);
+      }
+      RecordBatchVector batches;
+      int index = 0;
+    } Generator;

Review comment:
       Ah, this is a neat trick for me to learn.  Is this basically creating an 
instance of an anonymous struct?




-- 
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]


Reply via email to