summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sbe/values/value_serialization_test.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-14 14:26:38 -0300
commit294bc6ecabf14c09c9bc8644704921dcf97cb44e (patch)
tree279b1e0bab53901a1647ac63c1c724f0f789a663 /src/mongo/db/exec/sbe/values/value_serialization_test.cpp
parent70be7c27a251621187a1de533462ae2bb1e3bd39 (diff)
parent1e917fd798aa25b7066d4b414b51184f13d5a092 (diff)
Update upstream source from tag 'upstream/6.0.10'debian/6.0.10-1
Update to upstream version '6.0.10' with Debian dir 2d176fa254eee97b139f712fec5709641335a8c3
Diffstat (limited to 'src/mongo/db/exec/sbe/values/value_serialization_test.cpp')
-rw-r--r--src/mongo/db/exec/sbe/values/value_serialization_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mongo/db/exec/sbe/values/value_serialization_test.cpp b/src/mongo/db/exec/sbe/values/value_serialization_test.cpp
index 5b44bef6549..3be3212c627 100644
--- a/src/mongo/db/exec/sbe/values/value_serialization_test.cpp
+++ b/src/mongo/db/exec/sbe/values/value_serialization_test.cpp
@@ -268,6 +268,18 @@ TEST_F(ValueSerializeForKeyString, SbeArray) {
runTest({{testDataTag, testDataVal}});
}
+TEST_F(ValueSerializeForKeyString, ArraySet) {
+ auto [tag, val] = sbe::value::makeNewArraySet();
+ sbe::value::ValueGuard guard{tag, val};
+ auto* arraySet = sbe::value::getArraySetView(val);
+
+ arraySet->push_back(value::TypeTags::NumberInt32, value::bitcastFrom<int32_t>(1));
+ arraySet->push_back(value::TypeTags::NumberInt64, value::bitcastFrom<int64_t>(2));
+ arraySet->push_back(value::TypeTags::NumberDouble, value::bitcastFrom<double>(3.0));
+
+ runTest({{tag, val}});
+}
+
TEST_F(ValueSerializeForKeyString, DateTime) {
runTest({{value::TypeTags::Date, value::bitcastFrom<int64_t>(1234)},
{value::TypeTags::Timestamp, value::bitcastFrom<uint64_t>(5678)}});
@@ -442,4 +454,17 @@ TEST_F(ValueSerializeForKeyString, BsonCodeWScope) {
runTest({{cwsTag1, cwsVal1}, {cwsTag2, cwsVal2}, {cwsTag3, cwsVal3}});
}
+
+// Test that roundtripping through KeyString works for a wide row. KeyStrings used in indexes are
+// typically constrained in the number of components they can have, since we limit compound indexes
+// to at most 32 components. But roundtripping rows wider than 32 still needs to work.
+//
+// This test was originally designed to reproduce SERVER-76321.
+TEST_F(ValueSerializeForKeyString, RoundtripWideRow) {
+ std::vector<std::pair<sbe::value::TypeTags, sbe::value::Value>> row;
+ for (int32_t i = 0; i < 40; ++i) {
+ row.emplace_back(sbe::value::TypeTags::NumberInt32, sbe::value::bitcastFrom<int32_t>(i));
+ }
+ runTest(row);
+}
} // namespace mongo::sbe