File tree Expand file tree Collapse file tree 6 files changed +72
-0
lines changed
Expand file tree Collapse file tree 6 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ v4.3.3 (2018-xx-xx)
1111* added TransactionOptions.maxTransactionSize(Long)
1212* added TransactionOptions.intermediateCommitCount(Long)
1313* added TransactionOptions.intermediateCommitSize(Long)
14+ * added QueryEntity.getBindVars(): Map<String, Object>
15+ * added QueryEntity.getState(): QueryExecutionState
1416
1517v4.3.2 (2017-11-30)
1618---------------------------
Original file line number Diff line number Diff line change 2121package com .arangodb .entity ;
2222
2323import java .util .Date ;
24+ import java .util .Map ;
2425
2526/**
2627 * @author Mark Vollmary
@@ -34,6 +35,8 @@ public class QueryEntity {
3435 private String query ;
3536 private Date started ;
3637 private Double runTime ;
38+ private Map <String , Object > bindVars ;
39+ private QueryExecutionState state ;
3740
3841 public QueryEntity () {
3942 super ();
@@ -68,4 +71,18 @@ public Double getRunTime() {
6871 return runTime ;
6972 }
7073
74+ /**
75+ * @return the bind parameter values used by the query
76+ */
77+ public Map <String , Object > getBindVars () {
78+ return bindVars ;
79+ }
80+
81+ /**
82+ * @return the query's current execution state
83+ */
84+ public QueryExecutionState getState () {
85+ return state ;
86+ }
87+
7188}
Original file line number Diff line number Diff line change 1+ /*
2+ * DISCLAIMER
3+ *
4+ * Copyright 2018 ArangoDB GmbH, Cologne, Germany
5+ *
6+ * Licensed under the Apache License, Version 2.0 (the "License");
7+ * you may not use this file except in compliance with the License.
8+ * You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing, software
13+ * distributed under the License is distributed on an "AS IS" BASIS,
14+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ * See the License for the specific language governing permissions and
16+ * limitations under the License.
17+ *
18+ * Copyright holder is ArangoDB GmbH, Cologne, Germany
19+ */
20+
21+ package com .arangodb .entity ;
22+
23+ /**
24+ * @author Mark Vollmary
25+ *
26+ */
27+ public enum QueryExecutionState {
28+ INITIALIZING ,
29+ PARSING ,
30+ OPTIMIZING_AST ,
31+ LOADING_COLLECTIONS ,
32+ INSTANTIATING_PLAN ,
33+ OPTIMIZING_PLAN ,
34+ EXECUTING ,
35+ FINALIZING ,
36+ FINISHED ,
37+ INVALID
38+ }
Original file line number Diff line number Diff line change 3636import com .arangodb .entity .CollectionType ;
3737import com .arangodb .entity .LogLevel ;
3838import com .arangodb .entity .Permissions ;
39+ import com .arangodb .entity .QueryExecutionState ;
3940import com .arangodb .velocypack .VPackDeserializationContext ;
4041import com .arangodb .velocypack .VPackDeserializer ;
4142import com .arangodb .velocypack .VPackSlice ;
@@ -157,4 +158,14 @@ public Permissions deserialize(
157158 return Permissions .valueOf (vpack .getAsString ().toUpperCase ());
158159 }
159160 };
161+
162+ public static final VPackDeserializer <QueryExecutionState > QUERY_EXECUTION_STATE = new VPackDeserializer <QueryExecutionState >() {
163+ @ Override
164+ public QueryExecutionState deserialize (
165+ final VPackSlice parent ,
166+ final VPackSlice vpack ,
167+ final VPackDeserializationContext context ) throws VPackException {
168+ return QueryExecutionState .valueOf (vpack .getAsString ().toUpperCase ().replaceAll (" " , "_" ));
169+ }
170+ };
160171}
Original file line number Diff line number Diff line change 3232import com .arangodb .entity .LogLevel ;
3333import com .arangodb .entity .Permissions ;
3434import com .arangodb .entity .QueryEntity ;
35+ import com .arangodb .entity .QueryExecutionState ;
3536import com .arangodb .internal .velocystream .internal .AuthenticationRequest ;
3637import com .arangodb .model .TraversalOptions ;
3738import com .arangodb .velocypack .VPackFieldNamingStrategy ;
@@ -78,6 +79,7 @@ public String translateName(final Field field) {
7879 context .registerDeserializer (LogLevel .class , VPackDeserializers .LOG_LEVEL );
7980 context .registerDeserializer (ArangoDBVersion .License .class , VPackDeserializers .LICENSE );
8081 context .registerDeserializer (Permissions .class , VPackDeserializers .PERMISSIONS );
82+ context .registerDeserializer (QueryExecutionState .class , VPackDeserializers .QUERY_EXECUTION_STATE );
8183 }
8284
8385 @ Override
Original file line number Diff line number Diff line change 6666import com .arangodb .entity .QueryCachePropertiesEntity ;
6767import com .arangodb .entity .QueryCachePropertiesEntity .CacheMode ;
6868import com .arangodb .entity .QueryEntity ;
69+ import com .arangodb .entity .QueryExecutionState ;
6970import com .arangodb .entity .QueryTrackingPropertiesEntity ;
7071import com .arangodb .entity .ServerRole ;
7172import com .arangodb .entity .TraversalEntity ;
@@ -843,6 +844,7 @@ public void run() {
843844 assertThat (currentlyRunningQueries .size (), is (1 ));
844845 final QueryEntity queryEntity = currentlyRunningQueries .iterator ().next ();
845846 assertThat (queryEntity .getQuery (), is ("return sleep(0.2)" ));
847+ assertThat (queryEntity .getState (), is (QueryExecutionState .EXECUTING ));
846848 } finally {
847849 t .join ();
848850 }
You can’t perform that action at this time.
0 commit comments