diff options
author | Justin Zhang <justin.zhang@mongodb.com> | 2022-07-29 23:24:20 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-30 00:27:09 +0000 |
commit | 123eda7b00d3ed74e3b15c351ae029e720a8b80c (patch) | |
tree | 50cb29175ec0f3a16f344e98fb3cac241af6d247 /src/mongo/db/index/columns_access_method.cpp | |
parent | a2a8ab39110826d70081ee680f34bb9d342d24d5 (diff) | |
download | mongo-123eda7b00d3ed74e3b15c351ae029e720a8b80c.tar.gz |
SERVER-63123 Add support for creating columnar indexes with a subset of fields via projection
Diffstat (limited to 'src/mongo/db/index/columns_access_method.cpp')
-rw-r--r-- | src/mongo/db/index/columns_access_method.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/index/columns_access_method.cpp b/src/mongo/db/index/columns_access_method.cpp index b29ec20967a..b4c21443591 100644 --- a/src/mongo/db/index/columns_access_method.cpp +++ b/src/mongo/db/index/columns_access_method.cpp @@ -40,6 +40,7 @@ #include "mongo/db/index/column_cell.h" #include "mongo/db/index/column_key_generator.h" #include "mongo/db/index/column_store_sorter.h" +#include "mongo/db/index/index_descriptor.h" #include "mongo/logv2/log.h" #include "mongo/util/progress_meter.h" @@ -56,7 +57,18 @@ inline void inc(int64_t* counter) { ColumnStoreAccessMethod::ColumnStoreAccessMethod(IndexCatalogEntry* ice, std::unique_ptr<ColumnStore> store) - : _store(std::move(store)), _indexCatalogEntry(ice), _descriptor(ice->descriptor()) {} + : _store(std::move(store)), + _indexCatalogEntry(ice), + _descriptor(ice->descriptor()), + _keyGen(_descriptor->keyPattern(), _descriptor->pathProjection()) { + // Normalize the 'columnstoreProjection' index option to facilitate its comparison as part of + // index signature. + if (!_descriptor->pathProjection().isEmpty()) { + auto* projExec = getColumnstoreProjection()->exec(); + ice->descriptor()->_setNormalizedPathProjection( + projExec->serializeTransformation(boost::none).toBson()); + } +} class ColumnStoreAccessMethod::BulkBuilder final : public IndexAccessMethod::BulkBuilder { public: |