Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchengchenghh committed Dec 11, 2024
1 parent 475cfa4 commit fc74211
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions velox/exec/tests/SpillTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ TEST_P(SpillTest, multipleSortKeys) {
vectors.push_back(makeArrayVector<int32_t>({{1, 2, 3}, {3, 4, 5}}));
}
state.appendToPartition(partitionIndex, makeRowVector({vectors}));
state.appendToPartition(partitionIndex, makeRowVector({vectors}));
state.finishFile(partitionIndex);
EXPECT_TRUE(
state.testingNonEmptySpilledPartitionSet().contains(partitionIndex));
Expand All @@ -997,18 +998,22 @@ TEST_P(SpillTest, multipleSortKeys) {
1 << 20, testData.mergePrefixComparatorEnabled, pool(), &spillStats_);
ASSERT_TRUE(merge != nullptr);

for (auto i = 0; i < timeValues.size(); ++i) {
auto* stream = merge->next();
ASSERT_NE(stream, nullptr);
ASSERT_EQ(
timeValues[i],
stream->decoded(0).valueAt<Timestamp>(stream->currentIndex()));

ASSERT_EQ(
intValues[i],
stream->decoded(1).valueAt<int64_t>(stream->currentIndex()));
stream->pop();
}
const auto testMerge = [] {
for (auto i = 0; i < timeValues.size(); ++i) {
auto* stream = merge->next();
ASSERT_NE(stream, nullptr);
ASSERT_EQ(
timeValues[i],
stream->decoded(0).valueAt<Timestamp>(stream->currentIndex()));

ASSERT_EQ(
intValues[i],
stream->decoded(1).valueAt<int64_t>(stream->currentIndex()));
stream->pop();
}
};
testMerge();
testMerge();
ASSERT_EQ(nullptr, merge->next());
}
}
Expand Down

0 comments on commit fc74211

Please sign in to comment.