@@ -1414,8 +1414,7 @@ private <R> QueryList<R> optimizeQueries(Query query,
1414
1414
1415
1415
private Query optimizeQuery (ConditionQuery query ) {
1416
1416
if (query .idsSize () > 0 ) {
1417
- throw new HugeException (
1418
- "Not supported querying by id and conditions: %s" , query );
1417
+ throw new HugeException ("Not supported querying by id and conditions: %s" , query );
1419
1418
}
1420
1419
1421
1420
Id label = query .condition (HugeKeys .LABEL );
@@ -1435,11 +1434,10 @@ private Query optimizeQuery(ConditionQuery query) {
1435
1434
String primaryValues = query .userpropValuesString (keys );
1436
1435
LOG .debug ("Query vertices by primaryKeys: {}" , query );
1437
1436
// Convert {vertex-label + primary-key} to vertex-id
1438
- Id id = SplicingIdGenerator .splicing (label .asString (),
1439
- primaryValues );
1437
+ Id id = SplicingIdGenerator .splicing (label .asString (), primaryValues );
1440
1438
/*
1441
- * Just query by primary-key(id), ignore other userprop (if
1442
- * exists) that it will be filtered by queryVertices(Query)
1439
+ * Just query by primary-key(id), ignore other user-props (if exists)
1440
+ * that it will be filtered by queryVertices(Query)
1443
1441
*/
1444
1442
return new IdQuery (query , id );
1445
1443
}
@@ -1462,23 +1460,24 @@ private Query optimizeQuery(ConditionQuery query) {
1462
1460
VertexLabel vertexLabel = graph ().vertexLabel (vertex .label ());
1463
1461
return edgeLabel .linkWithVertexLabel (vertexLabel .id (), dir );
1464
1462
}).collect (Collectors .toList ());
1463
+
1465
1464
if (CollectionUtils .isEmpty (filterVertexList )) {
1466
- // Return empty query to skip storage query
1467
1465
return new Query (query .resultType ());
1468
- } else if (vertexIdList .size () != filterVertexList .size ()) {
1466
+ }
1467
+
1468
+ if (vertexIdList .size () != filterVertexList .size ()) {
1469
1469
// Modify on the copied relation to avoid affecting other query
1470
- Condition .Relation relation = query .copyRelationAndUpdateQuery (HugeKeys .OWNER_VERTEX );
1470
+ Condition .Relation relation =
1471
+ query .copyRelationAndUpdateQuery (HugeKeys .OWNER_VERTEX );
1471
1472
relation .value (filterVertexList );
1472
1473
}
1473
1474
} else if (query .containsRelation (HugeKeys .OWNER_VERTEX , Condition .RelationType .EQ )) {
1474
- // For EQ query, just skip query if adjacent schema is unavailable.
1475
1475
Id vertexId = query .condition (HugeKeys .OWNER_VERTEX );
1476
- Iterator <Vertex > iter = this .queryVertices (vertexId );
1477
- Vertex vertex = QueryResults .one (iter );
1476
+ Vertex vertex = QueryResults .one (this .queryVertices (vertexId ));
1478
1477
if (vertex != null ) {
1479
1478
VertexLabel vertexLabel = graph ().vertexLabel (vertex .label ());
1479
+ // For EQ query, just skip query storage if adjacent schema doesn't exist
1480
1480
if (!edgeLabel .linkWithVertexLabel (vertexLabel .id (), dir )) {
1481
- // Return empty query to skip storage query
1482
1481
return new Query (query .resultType ());
1483
1482
}
1484
1483
}
@@ -1490,8 +1489,8 @@ private Query optimizeQuery(ConditionQuery query) {
1490
1489
query = query .copy ();
1491
1490
// Serialize sort-values
1492
1491
List <Id > keys = this .graph ().edgeLabel (label ).sortKeys ();
1493
- List <Condition > conditions = GraphIndexTransaction . constructShardConditions (
1494
- query , keys , HugeKeys .SORT_VALUES );
1492
+ List <Condition > conditions = GraphIndexTransaction
1493
+ . constructShardConditions ( query , keys , HugeKeys .SORT_VALUES );
1495
1494
query .query (conditions );
1496
1495
/*
1497
1496
* Reset all userprop since transferred to sort-keys, ignore other
0 commit comments