Skip to content

Commit 1806167

Browse files
committed
fix: minor optimization in query engine class/cluster filtering
1 parent fab3ebc commit 1806167

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

core/src/main/java/com/orientechnologies/orient/core/sql/executor/GetValueFromIndexEntryStep.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public GetValueFromIndexEntryStep(
2323
OCommandContext ctx, int[] filterClusterIds, boolean profilingEnabled) {
2424
super(ctx, profilingEnabled);
2525
this.filterClusterIds = filterClusterIds;
26+
Arrays.sort(this.filterClusterIds);
2627
}
2728

2829
@Override
@@ -42,14 +43,8 @@ private OResult filterMap(OResult result, OCommandContext ctx) {
4243
return null;
4344
}
4445
ORID rid = ((OIdentifiable) finalVal).getIdentity();
45-
boolean found = false;
46-
for (int filterClusterId : filterClusterIds) {
47-
if (rid.getClusterId() < 0 || filterClusterId == rid.getClusterId()) {
48-
found = true;
49-
break;
50-
}
51-
}
52-
if (!found) {
46+
if (rid.getClusterId() >= 0
47+
&& Arrays.binarySearch(filterClusterIds, rid.getClusterId()) < 0) {
5348
return null;
5449
}
5550
}

0 commit comments

Comments
 (0)