File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
main/java/com/arangodb/entity Expand file tree Collapse file tree 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 {
8282 private Boolean isConst ;
8383 private Boolean canThrow ;
8484 private String expressionType ;
85- private IndexEntity indexes ;
85+ private Collection < IndexEntity > indexes ;
8686 private ExecutionExpression expression ;
8787 private ExecutionCollection condition ;
8888 private Boolean reverse ;
@@ -163,7 +163,7 @@ public String getExpressionType() {
163163 return expressionType ;
164164 }
165165
166- public IndexEntity getIndexes () {
166+ public Collection < IndexEntity > getIndexes () {
167167 return indexes ;
168168 }
169169
Original file line number Diff line number Diff line change @@ -913,6 +913,34 @@ public void explainQuery() {
913913 assertThat (plan .getNodes ().size (), is (greaterThan (0 )));
914914 }
915915
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+
916944 @ Test
917945 public void parseQuery () {
918946 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