diff options
author | Yoonsoo Kim <yoonsoo.kim@mongodb.com> | 2023-05-01 15:19:22 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-01 16:53:33 +0000 |
commit | 7392e769e26e3bcb47085903d1530a073724c64e (patch) | |
tree | 5626073e062adc109bf4c543adbb9e96f612ab82 /src/mongo/db/query | |
parent | 2e4e0966a2c9c6b2e77f23513388d1def7072f81 (diff) | |
download | mongo-7392e769e26e3bcb47085903d1530a073724c64e.tar.gz |
SERVER-76704 Fix the build error caused by resolveCollator()
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/collation/collator_factory_interface.cpp | 28 | ||||
-rw-r--r-- | src/mongo/db/query/collation/collator_factory_interface.h | 26 |
2 files changed, 0 insertions, 54 deletions
diff --git a/src/mongo/db/query/collation/collator_factory_interface.cpp b/src/mongo/db/query/collation/collator_factory_interface.cpp index 1ad564f8316..c3f2c4d4571 100644 --- a/src/mongo/db/query/collation/collator_factory_interface.cpp +++ b/src/mongo/db/query/collation/collator_factory_interface.cpp @@ -29,10 +29,6 @@ #include "mongo/db/query/collation/collator_factory_interface.h" -#include "mongo/bson/bsonobj.h" -#include "mongo/db/catalog/collection.h" -#include "mongo/db/operation_context.h" -#include "mongo/db/pipeline/expression_context.h" #include "mongo/db/service_context.h" namespace mongo { @@ -54,28 +50,4 @@ void CollatorFactoryInterface::set(ServiceContext* serviceContext, getCollatorFactory(serviceContext) = std::move(collatorFactory); } -std::pair<std::unique_ptr<CollatorInterface>, ExpressionContext::CollationMatchesDefault> -resolveCollator(OperationContext* opCtx, BSONObj userCollation, const CollectionPtr& collection) { - if (!collection || !collection->getDefaultCollator()) { - if (userCollation.isEmpty()) { - return {nullptr, ExpressionContext::CollationMatchesDefault::kNoDefault}; - } else { - return {getUserCollator(opCtx, userCollation), - ExpressionContext::CollationMatchesDefault::kNoDefault}; - } - } - - auto defaultCollator = collection->getDefaultCollator()->clone(); - if (userCollation.isEmpty()) { - return {std::move(defaultCollator), ExpressionContext::CollationMatchesDefault::kYes}; - } - auto userCollator = getUserCollator(opCtx, userCollation); - - if (CollatorInterface::collatorsMatch(defaultCollator.get(), userCollator.get())) { - return {std::move(defaultCollator), ExpressionContext::CollationMatchesDefault::kYes}; - } else { - return {std::move(userCollator), ExpressionContext::CollationMatchesDefault::kNo}; - } -} - } // namespace mongo diff --git a/src/mongo/db/query/collation/collator_factory_interface.h b/src/mongo/db/query/collation/collator_factory_interface.h index 2819783f596..c13b8c8fbe5 100644 --- a/src/mongo/db/query/collation/collator_factory_interface.h +++ b/src/mongo/db/query/collation/collator_factory_interface.h @@ -31,11 +31,6 @@ #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/bson/bsonobj.h" -#include "mongo/db/catalog/collection.h" -#include "mongo/db/operation_context.h" -#include "mongo/db/pipeline/expression_context.h" - namespace mongo { class BSONObj; @@ -81,25 +76,4 @@ public: virtual StatusWith<std::unique_ptr<CollatorInterface>> makeFromBSON(const BSONObj& spec) = 0; }; -/** - * Returns a collator for the user-specified collation 'userCollation'. - * - * Note: The caller should check if 'userCollation' is not empty since the empty 'userCollation' - * has the special meaning that the query follows the collection default collation that exists. - */ -inline std::unique_ptr<CollatorInterface> getUserCollator(OperationContext* opCtx, - const BSONObj& userCollation) { - tassert(7542402, "Empty user collation", !userCollation.isEmpty()); - return uassertStatusOK( - CollatorFactoryInterface::get(opCtx->getServiceContext())->makeFromBSON(userCollation)); -} - -/** - * Resolves the collator to either the user-specified collation or, if none was specified, to - * the collection-default collation and also returns a flag indicating whether the user-provided - * collation matches the collection default collation. - */ -std::pair<std::unique_ptr<CollatorInterface>, ExpressionContext::CollationMatchesDefault> -resolveCollator(OperationContext* opCtx, BSONObj userCollation, const CollectionPtr& collection); - } // namespace mongo |