| 731 | ASSERT_OK(iterator_.Init(batch, max_chunksize)); |
| 732 | } |
| 733 | void CheckIteration(const ExecBatch& input, int chunksize, |
| 734 | const std::vector<int>& ex_batch_sizes) { |
| 735 | SetupIterator(input, chunksize); |
| 736 | ExecSpan batch; |
| 737 | int64_t position = 0; |
| 738 | for (size_t i = 0; i < ex_batch_sizes.size(); ++i) { |
| 739 | ASSERT_EQ(position, iterator_.position()); |
| 740 | ASSERT_TRUE(iterator_.Next(&batch)); |
| 741 | ASSERT_EQ(ex_batch_sizes[i], batch.length); |
| 742 | |
| 743 | for (size_t j = 0; j < input.values.size(); ++j) { |
| 744 | switch (input[j].kind()) { |
| 745 | case Datum::SCALAR: |
| 746 | ASSERT_TRUE(input[j].scalar()->Equals(*batch[j].scalar)); |
| 747 | break; |
| 748 | case Datum::ARRAY: |
| 749 | AssertArraysEqual(*input[j].make_array()->Slice(position, batch.length), |
| 750 | *batch[j].array.ToArray()); |
| 751 | break; |
| 752 | case Datum::CHUNKED_ARRAY: { |
| 753 | const ChunkedArray& carr = *input[j].chunked_array(); |
| 754 | if (batch.length == 0) { |
| 755 | ASSERT_EQ(0, carr.length()); |
| 756 | } else { |
| 757 | auto arg_slice = carr.Slice(position, batch.length); |
| 758 | // The sliced ChunkedArrays should only ever be 1 chunk |
| 759 | ASSERT_EQ(1, arg_slice->num_chunks()); |
| 760 | AssertArraysEqual(*arg_slice->chunk(0), *batch[j].array.ToArray()); |
| 761 | } |
| 762 | } break; |
| 763 | default: |
| 764 | break; |
| 765 | } |
| 766 | } |
| 767 | position += ex_batch_sizes[i]; |
| 768 | } |
| 769 | // Ensure that the iterator is exhausted |
| 770 | ASSERT_FALSE(iterator_.Next(&batch)); |
| 771 | |
| 772 | ASSERT_EQ(iterator_.length(), iterator_.position()); |
| 773 | } |
| 774 | |
| 775 | protected: |
| 776 | ExecSpanIterator iterator_; |
nothing calls this directly
no test coverage detected