Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 18b0a51

Browse files
authored
[ES-2266] Support all AQL query options in ArangoDatabase.explainAqlQuery() (#589)
* updated AqlQueryOptions * added AqlQueryOptions custom options * created new method overload ArangoDatabase.explainAqlQuery accepting all AQL query options
1 parent 9202836 commit 18b0a51

File tree

14 files changed

+1551
-455
lines changed

14 files changed

+1551
-455
lines changed

‎core/src/main/java/com/arangodb/ArangoDatabase.java‎

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
6969
* Returns the name of the used storage engine.
7070
*
7171
* @return the storage engine name
72-
* @see
73-
* <a href="https://docs.arangodb.com/stable/develop/http-api/administration/#get-the-storage-engine-type">API
72+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/administration/#get-the-storage-engine-type">API
7473
* Documentation</a>
7574
*/
7675
ArangoDBEngine getEngine();
@@ -79,8 +78,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
7978
* Checks whether the database exists
8079
*
8180
* @return true if the database exists, otherwise false
82-
* @see
83-
* <a href="https://docs.arangodb.com/stable/develop/http-api/databases/#get-information-about-the-current-database">API
81+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/databases/#get-information-about-the-current-database">API
8482
* Documentation</a>
8583
*/
8684
boolean exists();
@@ -149,8 +147,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
149147
*
150148
* @param id The index-handle
151149
* @return information about the index
152-
* @see
153-
* <a href="https://docs.arangodb.com/stable/develop/http-api/indexes/#get-an-index">API Documentation</a>
150+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/indexes/#get-an-index">API Documentation</a>
154151
*/
155152
IndexEntity getIndex(String id);
156153

@@ -159,8 +156,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
159156
*
160157
* @param id The index-handle
161158
* @return the id of the index
162-
* @see
163-
* <a href="https://docs.arangodb.com/stable/develop/http-api/indexes/#delete-an-index">API Documentation</a>
159+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/indexes/#delete-an-index">API Documentation</a>
164160
*/
165161
String deleteIndex(String id);
166162

@@ -229,9 +225,9 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
229225
*
230226
* @param user The name of the user
231227
* @param permissions The permissions the user grant
232-
* @since ArangoDB 3.2.0
233228
* @see <a href= "https://docs.arangodb.com/stable/develop/http-api/users/#set-a-users-database-access-level">
234229
* API Documentation</a>
230+
* @since ArangoDB 3.2.0
235231
*/
236232
void grantDefaultCollectionAccess(String user, Permissions permissions);
237233

@@ -255,8 +251,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
255251
* @param bindVars key/value pairs defining the variables to bind the query to
256252
* @param options Additional options that will be passed to the query API, can be null
257253
* @return cursor of the results
258-
* @see
259-
* <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
254+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
260255
* Documentation</a>
261256
*/
262257
<T> ArangoCursor<T> query(String query, Class<T> type, Map<String, Object> bindVars, AqlQueryOptions options);
@@ -269,8 +264,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
269264
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
270265
* @param options Additional options that will be passed to the query API, can be null
271266
* @return cursor of the results
272-
* @see
273-
* <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
267+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
274268
* Documentation</a>
275269
*/
276270
<T> ArangoCursor<T> query(String query, Class<T> type, AqlQueryOptions options);
@@ -283,8 +277,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
283277
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
284278
* @param bindVars key/value pairs defining the variables to bind the query to
285279
* @return cursor of the results
286-
* @see
287-
* <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
280+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
288281
* Documentation</a>
289282
*/
290283
<T> ArangoCursor<T> query(String query, Class<T> type, Map<String, Object> bindVars);
@@ -296,8 +289,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
296289
* @param query An AQL query string
297290
* @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
298291
* @return cursor of the results
299-
* @see
300-
* <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
292+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#create-a-cursor">API
301293
* Documentation</a>
302294
*/
303295
<T> ArangoCursor<T> query(String query, Class<T> type);
@@ -378,9 +370,25 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
378370
* @return information about the query
379371
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#explain-an-aql-query">API
380372
* Documentation</a>
373+
*
374+
* @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead
381375
*/
376+
@Deprecated
382377
AqlQueryExplainEntity explainAqlQuery(String query, Map<String, Object> bindVars, AqlQueryExplainOptions options);
383378

379+
380+
/**
381+
* Explain an AQL query and return information about it
382+
*
383+
* @param query the query which you want explained
384+
* @param bindVars key/value pairs representing the bind parameters
385+
* @param options Additional options, can be null
386+
* @return information about the query
387+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/queries/aql-queries/#explain-an-aql-query">API
388+
* Documentation</a>
389+
*/
390+
AqlQueryExplainEntity explainAqlQuery(String query, Map<String, Object> bindVars, ExplainAqlQueryOptions options);
391+
384392
/**
385393
* Parse an AQL query and return information about it This method is for query validation only. To actually query
386394
* the database, see {@link ArangoDatabase#query(String, Class, Map, AqlQueryOptions)}
@@ -575,8 +583,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
575583
*
576584
* @param options Additional options, can be null
577585
* @return information about the transaction
578-
* @see
579-
* <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#begin-a-stream-transaction">API
586+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#begin-a-stream-transaction">API
580587
* Documentation</a>
581588
* @since ArangoDB 3.5.0
582589
*/
@@ -586,8 +593,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
586593
* Aborts a Stream Transaction.
587594
*
588595
* @return information about the transaction
589-
* @see
590-
* <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#abort-a-stream-transaction">API
596+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#abort-a-stream-transaction">API
591597
* Documentation</a>
592598
*/
593599
StreamTransactionEntity abortStreamTransaction(String id);
@@ -596,8 +602,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
596602
* Gets information about a Stream Transaction.
597603
*
598604
* @return information about the transaction
599-
* @see
600-
* <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#get-the-status-of-a-stream-transaction">
605+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#get-the-status-of-a-stream-transaction">
601606
* API Documentation</a>
602607
* @since ArangoDB 3.5.0
603608
*/
@@ -607,8 +612,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
607612
* Gets all the currently running Stream Transactions.
608613
*
609614
* @return all the currently running Stream Transactions
610-
* @see
611-
* <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#list-the-running-stream-transactions">
615+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#list-the-running-stream-transactions">
612616
* API Documentation</a>
613617
* @since ArangoDB 3.5.0
614618
*/
@@ -618,8 +622,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
618622
* Commits a Stream Transaction.
619623
*
620624
* @return information about the transaction
621-
* @see
622-
* <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#commit-a-stream-transaction">
625+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/transactions/stream-transactions/#commit-a-stream-transaction">
623626
* API Documentation</a>
624627
* @since ArangoDB 3.5.0
625628
*/
@@ -648,8 +651,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
648651
* Fetches all views from the database and returns a list of view descriptions.
649652
*
650653
* @return list of information about all views
651-
* @see
652-
* <a href="https://docs.arangodb.com/stable/develop/http-api/views/arangosearch-views/#list-all-views">API Documentation</a>
654+
* @see <a href="https://docs.arangodb.com/stable/develop/http-api/views/arangosearch-views/#list-all-views">API Documentation</a>
653655
* @since ArangoDB 3.4.0
654656
*/
655657
Collection<ViewEntity> getViews();

‎core/src/main/java/com/arangodb/ArangoDatabaseAsync.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,17 @@ public interface ArangoDatabaseAsync extends ArangoSerdeAccessor {
172172

173173
/**
174174
* Asynchronous version of {@link ArangoDatabase#explainAqlQuery(String, Map, AqlQueryExplainOptions)}
175+
*
176+
* @deprecated for removal, use {@link ArangoDatabaseAsync#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead
175177
*/
178+
@Deprecated
176179
CompletableFuture<AqlQueryExplainEntity> explainAqlQuery(String query, Map<String, Object> bindVars, AqlQueryExplainOptions options);
177180

181+
/**
182+
* Asynchronous version of {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)}
183+
*/
184+
CompletableFuture<AqlQueryExplainEntity> explainAqlQuery(String query, Map<String, Object> bindVars, ExplainAqlQueryOptions options);
185+
178186
/**
179187
* Asynchronous version of {@link ArangoDatabase#parseQuery(String)}
180188
*/

‎core/src/main/java/com/arangodb/entity/AqlExecutionExplainEntity.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@
2020

2121
package com.arangodb.entity;
2222

23+
import com.arangodb.ArangoDatabase;
24+
import com.arangodb.model.ExplainAqlQueryOptions;
25+
2326
import java.util.Collection;
27+
import java.util.Map;
2428

2529
/**
2630
* @author Mark Vollmary
31+
* @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead
2732
*/
33+
@Deprecated
2834
public final class AqlExecutionExplainEntity {
2935

3036
private ExecutionPlan plan;

‎core/src/main/java/com/arangodb/internal/ArangoDatabaseAsyncImpl.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ public CompletableFuture<AqlQueryExplainEntity> explainAqlQuery(
229229
return executorAsync().execute(() -> explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class);
230230
}
231231

232+
@Override
233+
public CompletableFuture<AqlQueryExplainEntity> explainAqlQuery(String query, Map<String, Object> bindVars, ExplainAqlQueryOptions options) {
234+
return executorAsync().execute(() -> explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class);
235+
}
236+
232237
@Override
233238
public CompletableFuture<AqlParseEntity> parseQuery(final String query) {
234239
return executorAsync().execute(() -> parseQueryRequest(query), AqlParseEntity.class);

‎core/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ public AqlQueryExplainEntity explainAqlQuery(String query, Map<String, Object> b
249249
return executorSync().execute(explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class);
250250
}
251251

252+
@Override
253+
public AqlQueryExplainEntity explainAqlQuery(String query, Map<String, Object> bindVars, ExplainAqlQueryOptions options) {
254+
return executorSync().execute(explainQueryRequest(query, bindVars, options), AqlQueryExplainEntity.class);
255+
}
256+
252257
@Override
253258
public AqlParseEntity parseQuery(final String query) {
254259
return executorSync().execute(parseQueryRequest(query), AqlParseEntity.class);

‎core/src/main/java/com/arangodb/internal/InternalArangoDatabase.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ protected InternalRequest explainQueryRequest(final String query, final Map<Stri
179179
.setBody(getSerde().serialize(OptionsBuilder.build(opt, query, bindVars)));
180180
}
181181

182+
protected InternalRequest explainQueryRequest(final String query, final Map<String, Object> bindVars,
183+
final ExplainAqlQueryOptions options) {
184+
final ExplainAqlQueryOptions opt = options != null ? options : new ExplainAqlQueryOptions();
185+
return request(name, RequestType.POST, PATH_API_EXPLAIN)
186+
.setBody(getSerde().serialize(OptionsBuilder.build(opt, query, bindVars)));
187+
}
188+
182189
protected InternalRequest parseQueryRequest(final String query) {
183190
return request(name, RequestType.POST, PATH_API_QUERY).setBody(getSerde().serialize(OptionsBuilder.build(new AqlQueryParseOptions(), query)));
184191
}

‎core/src/main/java/com/arangodb/model/AqlQueryExplainOptions.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
package com.arangodb.model;
2222

23+
import com.arangodb.ArangoDatabase;
2324
import com.arangodb.internal.serde.UserDataInside;
2425

2526
import java.util.Collection;
@@ -28,7 +29,10 @@
2829
/**
2930
* @author Mark Vollmary
3031
* @author Michele Rastelli
32+
*
33+
* @deprecated for removal, use {@link ArangoDatabase#explainAqlQuery(String, Map, ExplainAqlQueryOptions)} instead
3134
*/
35+
@Deprecated
3236
public final class AqlQueryExplainOptions {
3337

3438
private Map<String, Object> bindVars;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /