SERVER-120835 Convert 'sbe::bson::getField()' to return TagValueView (#53626)
GitOrigin-RevId: 6f368aa139f2478ef2f177652dc34f88e3c0468a
This commit is contained in:
parent
7e93f98278
commit
aed49dadb4
@ -60,9 +60,7 @@ MONGO_COMPILER_ALWAYS_INLINE inline void placeFieldsFromRecordInAccessors(
|
||||
if (scanFieldAccessors.size() == 1) {
|
||||
// If we're only looking for 1 field, then it's more efficient to forgo the hashtable
|
||||
// and just use equality comparison.
|
||||
auto name = StringData{scanFieldNames[0]};
|
||||
auto [tag, val] = bson::getField(rawBson, name);
|
||||
scanFieldAccessors.front().reset(value::TagValueView{tag, val});
|
||||
scanFieldAccessors.front().reset(bson::getField(rawBson, scanFieldNames[0]));
|
||||
} else {
|
||||
// If we're looking for 2 or more fields, it's more efficient to use the hashtable.
|
||||
for (auto& accessor : scanFieldAccessors) {
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "mongo/util/modules.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
// TODO(SERVER-114140): Remove all MONGO_MOD_NEEDS_REPLACEMENT annotations
|
||||
|
||||
@ -98,8 +97,7 @@ inline const char* getValue(const char* be) noexcept {
|
||||
return be + 1 + strlen(be + 1) + 1;
|
||||
}
|
||||
|
||||
inline std::pair<value::TypeTags, value::Value> getField(const char* be,
|
||||
StringData fieldStr) noexcept {
|
||||
inline value::TagValueView getField(const char* be, StringData fieldStr) noexcept {
|
||||
const auto end = be + ConstDataView(be).read<LittleEndian<uint32_t>>();
|
||||
be += sizeof(int);
|
||||
const auto targetSize = fieldStr.size();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user