MCPcopy Create free account
hub / github.com/apache/arrow / AssertPartition

Method AssertPartition

cpp/src/arrow/dataset/partition_test.cc:93–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 }
92
93 void AssertPartition(const std::shared_ptr<Partitioning> partitioning,
94 const std::shared_ptr<RecordBatch> full_batch,
95 const RecordBatchVector& expected_batches,
96 const std::vector<compute::Expression>& expected_expressions) {
97 ASSERT_OK_AND_ASSIGN(auto partition_results, partitioning->Partition(full_batch));
98 std::shared_ptr<RecordBatch> rest = full_batch;
99
100 ASSERT_EQ(partition_results.batches.size(), expected_batches.size());
101
102 for (size_t i = 0; i < partition_results.batches.size(); i++) {
103 std::shared_ptr<RecordBatch> actual_batch = partition_results.batches[i];
104 compute::Expression actual_expression = partition_results.expressions[i];
105
106 auto expected_expression = std::find(expected_expressions.begin(),
107 expected_expressions.end(), actual_expression);
108 ASSERT_NE(expected_expression, expected_expressions.end())
109 << "Unexpected partition expr " << actual_expression.ToString();
110
111 auto expected_batch =
112 expected_batches[expected_expression - expected_expressions.begin()];
113
114 SCOPED_TRACE("Batch for " + expected_expression->ToString());
115 AssertBatchesEqual(*expected_batch, *actual_batch);
116 }
117 }
118
119 void AssertPartition(const std::shared_ptr<Partitioning> partitioning,
120 const std::shared_ptr<Schema> schema,

Callers

nothing calls this directly

Calls 7

AssertBatchesEqualFunction · 0.85
RecordBatchFromJSONFunction · 0.85
push_backMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected