Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mismatched exception type of unique index query #797

Merged
merged 6 commits into from
Jan 7, 2020
Merged

Conversation

zhoney
Copy link
Contributor

@zhoney zhoney commented Dec 26, 2019

fixed: #795
Change-Id: I9977a4cc05e3ee30d869ea32a043eddce216fa22

Change-Id: I9977a4cc05e3ee30d869ea32a043eddce216fa22
fixed: #795
@codecov
Copy link

codecov bot commented Dec 26, 2019

Codecov Report

Merging #797 into master will increase coverage by 0.6%.
The diff coverage is 84.61%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master     #797     +/-   ##
===========================================
+ Coverage     71.13%   71.74%   +0.6%     
- Complexity     4331     4380     +49     
===========================================
  Files           283      283             
  Lines         20957    20967     +10     
  Branches       2957     2959      +2     
===========================================
+ Hits          14908    15043    +135     
+ Misses         4568     4443    -125     
  Partials       1481     1481
Impacted Files Coverage Δ Complexity Δ
...ava/com/baidu/hugegraph/type/define/IndexType.java 89.47% <ø> (ø) 33 <0> (ø) ⬇️
...du/hugegraph/schema/builder/IndexLabelBuilder.java 86.79% <100%> (ø) 102 <0> (ø) ⬇️
...du/hugegraph/backend/tx/GraphIndexTransaction.java 81.05% <80%> (+0.2%) 180 <7> (+2) ⬆️
.../java/com/baidu/hugegraph/backend/query/Query.java 86.89% <0%> (-0.69%) 68% <0%> (ø)
...idu/hugegraph/job/schema/RebuildIndexCallable.java 86.95% <0%> (-0.19%) 20% <0%> (ø)
...a/com/baidu/hugegraph/backend/query/Condition.java 78% <0%> (ø) 31% <0%> (ø) ⬇️
...baidu/hugegraph/backend/store/BackendMutation.java 85.71% <0%> (+0.27%) 32% <0%> (ø) ⬇️
...hugegraph/backend/serializer/BinarySerializer.java 83.47% <0%> (+0.69%) 104% <0%> (+1%) ⬆️
...m/baidu/hugegraph/backend/tx/GraphTransaction.java 82.77% <0%> (+1.09%) 235% <0%> (+3%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef68289...8efe936. Read the comment docs.

@@ -592,7 +592,11 @@ private MatchedIndex collectMatchedIndex(SchemaLabel schemaLabel,
SchemaTransaction schema = this.graph().schemaTransaction();
Set<IndexLabel> ils = InsertionOrderUtil.newSet();
for (Id il : schemaLabel.indexLabels()) {
ils.add(schema.getIndexLabel(il));
IndexLabel indexLabel = schema.getIndexLabel(il);
if (indexLabel.indexType().isUniuqe()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isUniuqe => isUnique

ils.add(schema.getIndexLabel(il));
IndexLabel indexLabel = schema.getIndexLabel(il);
if (indexLabel.indexType().isUniuqe()) {
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not allowed to query by unique index

Change-Id: I11ec1986e51e2a957758892cf59ffb4912d5432d
Assert.assertThrows(NoIndexException.class, () -> {
graph.traversal().V().hasLabel("node").has("name", "tom").next();
}, (e) -> {
Assert.assertTrue(e.getMessage().equals(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertEquals

Assert.assertThrows(NoIndexException.class, () -> {
graph().traversal().E().hasLabel("like").has("weight", 0.5).next();
}, (e) -> {
Assert.assertTrue(e.getMessage().equals(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertEquals

Change-Id: I4cff5f7b914b3b62ad4e351bed60fed1e706ffe2
Change-Id: Iba850b598f05a652c10659efa251fb8a7bdf20a3
Change-Id: Id1f469218e6d537b221f6d930fdd0bc9dc344c85
@@ -3588,7 +3588,6 @@ public void testRemoveVertexOfNotExists() {
graph.tx().commit();
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comments why fail

Change-Id: Iaddf6e070a083002b8b17e238384cdd2f7e43a1e
@Linary Linary merged commit 81c1853 into master Jan 7, 2020
@Linary Linary deleted the unique branch January 7, 2020 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

在ID建唯一索引,web界面用g.V().has("id","1223")查询报错
3 participants