diff options
author | Terry Wang <tytytyww@google.com> | 2023-03-01 00:41:52 -0800 |
---|---|---|
committer | Terry Wang <tytytyww@google.com> | 2023-03-01 00:41:52 -0800 |
commit | e103b8ea56212b2a5abc082ce888843f19c7d567 (patch) | |
tree | 6621759619d3adf3d7285e110969ee082d7d2e0e /icing/join/doc-join-info_test.cc | |
parent | 5a41ca990be33387b0d5d15836a465bbe5ff5a28 (diff) | |
download | icing-e103b8ea56212b2a5abc082ce888843f19c7d567.tar.gz |
Update Icing from upstream.
Descriptions:
======================================================================
Add PropertyUtil for all property name/path related operations
======================================================================
[JoinableCache][2.0/x] Create SchemaPropertyIterator
======================================================================
[JoinableCache][2.1/x] Handle nested indexable flag
======================================================================
[JoinableCache][2.2/x] Add schema cycle dependency detection for SchemaPropertyIterator
======================================================================
[JoinableCache][3.0/x] Refactor SectionManager
======================================================================
[JoinableCache][3.1/x] Add unit tests for SectionManager::Builder and SchemaTypeManager
======================================================================
[NumericSearch][Storage][12/x] Implement Edit and GetIterator for IntegerIndex
======================================================================
[NumericSearch][Storage][13.0/x] Rename numeric-index_test as integer-index_test
======================================================================
[NumericSearch][Storage][13.1/x] Add IntegerIndexTest
======================================================================
Support the "len", "sum" and "avg" functions in advanced scoring.
======================================================================
Support the "this.childrenScores()" function to allow expressing children scores of joins in advanced scoring.
======================================================================
Create an integration test for Join with advanced scoring
======================================================================
Rename the word "children" to "args" for function related ScoreExpression
======================================================================
Improve IndexBlock by PRead/PWrite instead of repeating mmap/msync/unmap
======================================================================
Refactor QueryVisitor to prepare for support for function calls.
======================================================================
Add support for function calls.
======================================================================
Fix breakage in score-and-rank_benchmark.
======================================================================
[NumericSearch][Storage][adhoc][ez] Fix comment for IntegerIndex
======================================================================
[NumericSearch][Storage][14/x] Create first IntegerIndexStorage benchmark
======================================================================
Rename Icing schema related terminology to prepare for polymorphism support
======================================================================
[JoinableCache][4.0/x] Move common methods from SectionManager to PropertyUtil
======================================================================
[JoinableCache][4.1/x] Retire GetSectionContent
======================================================================
[JoinableCache][4.2/x] Polish SectionManagerTest
======================================================================
Modify QueryVisitor to do:
======================================================================
[NumericSearch][Storage][15/x] Implement TransferIndex for IntegerIndexStorage
======================================================================
[NumericSearch][Storage][16/x] Implement Optimize and last added document id for IntegerIndex
======================================================================
[NumericSearch][rollout][1/x] Include indexable int64 into SchemaDelta and backward compatibility
======================================================================
Add backwards compatibility test for Icing schema storage migration.
======================================================================
Implement trim the right-most node from the doc-hit-info-iterator.
======================================================================
Add TrimmedNode structure into doc-hit-info-iterator.
======================================================================
[JoinableCache][5/x] Implement JoinableProperty and JoinablePropertyManager
======================================================================
[JoinableCache][6/x] Add JoinablePropertyManager into SchemaTypeManager
======================================================================
[JoinableCache][7/x] Implement ExtractJoinableProperties
======================================================================
[JoinableCache][8/x] Create class QualifiedIdTypeJoinableCache
======================================================================
[JoinableCache][9/x] Implement factory method for QualifiedIdTypeJoinableCache
======================================================================
[JoinableCache][10/x] Implement Get and Put for QualifiedIdTypeJoinableCache
======================================================================
[JoinableCache][11/x] Add unit tests for QualifiedIdTypeJoinableCache
======================================================================
Modify DocHitInfoIteratorSectionRestrict to allow multi-property restricts
======================================================================
Fix the definition of LiteIndex::WantsMerge.
======================================================================
[NumericSearch][rollout][2.0/x] Rollout persistent IntegerIndex
======================================================================
[NumericSearch][rollout][2.1/x] Add more tests for integer index restoration and optimization
======================================================================
[JoinableCache][adhoc][ez] Remove qualified id type joinable cache size info from document storage info
======================================================================
Integrate trim right node into suggestion processor.
Bug: 208654892
Bug: 228240987
Bug: 249829533
Bug: 256081830
Bug: 259744228
Bug: 261474063
Bug: 263890397
Bug: 266103594
Bug: 268738297
Bug: 269295094
Change-Id: I5f1b3f3ed0b5d6933dc8c2ab3279904f7706b23e
Diffstat (limited to 'icing/join/doc-join-info_test.cc')
-rw-r--r-- | icing/join/doc-join-info_test.cc | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/icing/join/doc-join-info_test.cc b/icing/join/doc-join-info_test.cc new file mode 100644 index 0000000..7025473 --- /dev/null +++ b/icing/join/doc-join-info_test.cc @@ -0,0 +1,96 @@ +// Copyright (C) 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "icing/join/doc-join-info.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "icing/schema/joinable-property.h" +#include "icing/store/document-id.h" + +namespace icing { +namespace lib { + +namespace { + +using ::testing::Eq; +using ::testing::IsFalse; +using ::testing::IsTrue; + +static constexpr DocumentId kSomeDocumentId = 24; +static constexpr JoinablePropertyId kSomeJoinablePropertyId = 5; + +TEST(DocJoinInfoTest, Accessors) { + DocJoinInfo doc_join_info(kSomeDocumentId, kSomeJoinablePropertyId); + EXPECT_THAT(doc_join_info.document_id(), Eq(kSomeDocumentId)); + EXPECT_THAT(doc_join_info.joinable_property_id(), + Eq(kSomeJoinablePropertyId)); +} + +TEST(DocJoinInfoTest, Invalid) { + DocJoinInfo default_invalid; + EXPECT_THAT(default_invalid.is_valid(), IsFalse()); + + // Also make sure the invalid DocJoinInfo contains an invalid document id. + EXPECT_THAT(default_invalid.document_id(), Eq(kInvalidDocumentId)); + EXPECT_THAT(default_invalid.joinable_property_id(), + Eq(kMaxJoinablePropertyId)); +} + +TEST(DocJoinInfoTest, Valid) { + DocJoinInfo maximum_document_id_info(kMaxDocumentId, kSomeJoinablePropertyId); + EXPECT_THAT(maximum_document_id_info.is_valid(), IsTrue()); + EXPECT_THAT(maximum_document_id_info.document_id(), Eq(kMaxDocumentId)); + EXPECT_THAT(maximum_document_id_info.joinable_property_id(), + Eq(kSomeJoinablePropertyId)); + + DocJoinInfo maximum_joinable_property_id_info(kSomeDocumentId, + kMaxJoinablePropertyId); + EXPECT_THAT(maximum_joinable_property_id_info.is_valid(), IsTrue()); + EXPECT_THAT(maximum_joinable_property_id_info.document_id(), + Eq(kSomeDocumentId)); + EXPECT_THAT(maximum_joinable_property_id_info.joinable_property_id(), + Eq(kMaxJoinablePropertyId)); + + DocJoinInfo minimum_document_id_info(kMinDocumentId, kSomeJoinablePropertyId); + EXPECT_THAT(minimum_document_id_info.is_valid(), IsTrue()); + EXPECT_THAT(minimum_document_id_info.document_id(), Eq(kMinDocumentId)); + EXPECT_THAT(minimum_document_id_info.joinable_property_id(), + Eq(kSomeJoinablePropertyId)); + + DocJoinInfo minimum_joinable_property_id_info(kSomeDocumentId, + kMinJoinablePropertyId); + EXPECT_THAT(minimum_joinable_property_id_info.is_valid(), IsTrue()); + EXPECT_THAT(minimum_joinable_property_id_info.document_id(), + Eq(kSomeDocumentId)); + EXPECT_THAT(minimum_joinable_property_id_info.joinable_property_id(), + Eq(kMinJoinablePropertyId)); + + DocJoinInfo all_maximum_info(kMaxDocumentId, kMaxJoinablePropertyId); + EXPECT_THAT(all_maximum_info.is_valid(), IsTrue()); + EXPECT_THAT(all_maximum_info.document_id(), Eq(kMaxDocumentId)); + EXPECT_THAT(all_maximum_info.joinable_property_id(), + Eq(kMaxJoinablePropertyId)); + + DocJoinInfo all_minimum_info(kMinDocumentId, kMinJoinablePropertyId); + EXPECT_THAT(all_minimum_info.is_valid(), IsTrue()); + EXPECT_THAT(all_minimum_info.document_id(), Eq(kMinDocumentId)); + EXPECT_THAT(all_minimum_info.joinable_property_id(), + Eq(kMinJoinablePropertyId)); +} + +} // namespace + +} // namespace lib +} // namespace icing |