File tree 2 files changed +30
-2
lines changed
main/java/com/arangodb/entity
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public static class ExecutionNode {
82
82
private Boolean isConst ;
83
83
private Boolean canThrow ;
84
84
private String expressionType ;
85
- private IndexEntity indexes ;
85
+ private Collection < IndexEntity > indexes ;
86
86
private ExecutionExpression expression ;
87
87
private ExecutionCollection condition ;
88
88
private Boolean reverse ;
@@ -163,7 +163,7 @@ public String getExpressionType() {
163
163
return expressionType ;
164
164
}
165
165
166
- public IndexEntity getIndexes () {
166
+ public Collection < IndexEntity > getIndexes () {
167
167
return indexes ;
168
168
}
169
169
Original file line number Diff line number Diff line change @@ -913,6 +913,34 @@ public void explainQuery() {
913
913
assertThat (plan .getNodes ().size (), is (greaterThan (0 )));
914
914
}
915
915
916
+ @ Test
917
+ public void explainQueryWithIndexNode () {
918
+ ArangoCollection character = db .collection ("got_characters" );
919
+ ArangoCollection actor = db .collection ("got_actors" );
920
+
921
+ if (!character .exists ())
922
+ character .create ();
923
+
924
+ if (!actor .exists ())
925
+ actor .create ();
926
+
927
+ String query = "" +
928
+ "FOR `character` IN `got_characters` " +
929
+ " FOR `actor` IN `got_actors` " +
930
+ " FILTER `character`.`actor` == `actor`.`_id` " +
931
+ " RETURN `character`" ;
932
+
933
+ final ExecutionPlan plan = db .explainQuery (query , null , null ).getPlan ();
934
+ plan .getNodes ().stream ()
935
+ .filter (it -> "IndexNode" .equals (it .getType ()))
936
+ .flatMap (it -> it .getIndexes ().stream ())
937
+ .forEach (it -> {
938
+ assertThat (it .getType (), is (IndexType .primary ));
939
+ assertThat (it .getSelectivityEstimate (), is (1.0 ));
940
+ assertThat (it .getFields (), contains ("_key" ));
941
+ });
942
+ }
943
+
916
944
@ Test
917
945
public void parseQuery () {
918
946
final AqlParseEntity parse = arangoDB .db ().parseQuery ("for i in 1..1 return i" );
You can’t perform that action at this time.
0 commit comments