Skip to content

Commit ac7f58f

Browse files
duanmengfacebook-github-bot
authored andcommitted
Fix flaky GenericViewTest.toString (facebookincubator#9118)
Summary: `makeMapVectorFromJson` doesn't guarantee the order of the keys in the map and causes flakiness in `GenericViewTest.toString`. Verified by stress running the originally test 200 times. Pull Request resolved: facebookincubator#9118 Reviewed By: pedroerp Differential Revision: D55012894 Pulled By: mbasmanova fbshipit-source-id: 37dda7cc00f0802081814c61e0419e637f052fca
1 parent a092070 commit ac7f58f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

velox/expression/tests/GenericViewTest.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,15 @@ TEST_F(GenericViewTest, toString) {
230230

231231
auto mapView = reader[0];
232232
auto it = mapView.begin();
233-
EXPECT_EQ(keys->toString(0), it->first.toString());
234-
EXPECT_EQ(values->toString(0), it->second.value().toString());
235-
236-
++it;
237-
EXPECT_EQ(keys->toString(1), it->first.toString());
238-
239-
++it;
240-
EXPECT_EQ(keys->toString(2), it->first.toString());
241-
EXPECT_EQ(values->toString(2), it->second.value().toString());
233+
for (auto i = 0; i < 3; ++i) {
234+
EXPECT_EQ(keys->toString(i), it->first.toString());
235+
if (values->isNullAt(i)) {
236+
EXPECT_FALSE(it->second.has_value());
237+
} else {
238+
EXPECT_EQ(values->toString(i), it->second->toString());
239+
}
240+
++it;
241+
}
242242
}
243243
}
244244

0 commit comments

Comments
 (0)