Class DefaultAnalyticsQueryResult
- java.lang.Object
-
- com.couchbase.client.java.analytics.DefaultAnalyticsQueryResult
-
- All Implemented Interfaces:
AnalyticsQueryResult
,Iterable<AnalyticsQueryRow>
@Committed @Public public class DefaultAnalyticsQueryResult extends Object implements AnalyticsQueryResult
-
-
Constructor Summary
Constructors Constructor Description DefaultAnalyticsQueryResult(AsyncAnalyticsDeferredResultHandle asyncHandle, Object signature, AnalyticsMetrics info, List<JsonObject> errors, String finalStatus, Boolean finalSuccess, boolean parseSuccess, String requestId, String clientContextId)
Create a default blocking representation of a query result.DefaultAnalyticsQueryResult(List<AsyncAnalyticsQueryRow> rows, Object signature, AnalyticsMetrics info, List<JsonObject> errors, String finalStatus, Boolean finalSuccess, boolean parseSuccess, String requestId, String clientContextId)
Create a default blocking representation of a query result.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<AnalyticsQueryRow>
allRows()
String
clientContextId()
List<JsonObject>
errors()
boolean
finalSuccess()
Denotes the success or failure of the query.AnalyticsDeferredResultHandle
handle()
AnalyticsMetrics
info()
Iterator<AnalyticsQueryRow>
iterator()
boolean
parseSuccess()
String
requestId()
Iterator<AnalyticsQueryRow>
rows()
Object
signature()
String
status()
Returns the final status of the query.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DefaultAnalyticsQueryResult
public DefaultAnalyticsQueryResult(List<AsyncAnalyticsQueryRow> rows, Object signature, AnalyticsMetrics info, List<JsonObject> errors, String finalStatus, Boolean finalSuccess, boolean parseSuccess, String requestId, String clientContextId)
Create a default blocking representation of a query result.- Parameters:
rows
- the list of rows.signature
- the signature for rows.info
- the metrics.errors
- the list of errors and warnings.finalStatus
- the definitive (but potentially delayed) status of the query.finalSuccess
- the definitive (but potentially delayed) success of the query.parseSuccess
- the intermediate result of the query
-
DefaultAnalyticsQueryResult
public DefaultAnalyticsQueryResult(AsyncAnalyticsDeferredResultHandle asyncHandle, Object signature, AnalyticsMetrics info, List<JsonObject> errors, String finalStatus, Boolean finalSuccess, boolean parseSuccess, String requestId, String clientContextId)
Create a default blocking representation of a query result.- Parameters:
asyncHandle
- the deferred result handle.signature
- the signature for rows.info
- the metrics.errors
- the list of errors and warnings.finalStatus
- the definitive (but potentially delayed) status of the query.finalSuccess
- the definitive (but potentially delayed) success of the query.parseSuccess
- the intermediate result of the query
-
-
Method Detail
-
allRows
public List<AnalyticsQueryRow> allRows()
- Specified by:
allRows
in interfaceAnalyticsQueryResult
- Returns:
- the list of all
AnalyticsQueryRow
, the results of the query, if successful.
-
rows
public Iterator<AnalyticsQueryRow> rows()
- Specified by:
rows
in interfaceAnalyticsQueryResult
- Returns:
- an iterator over the list of all
AnalyticsQueryRow
, the results of the query, if successful.
-
signature
public Object signature()
- Specified by:
signature
in interfaceAnalyticsQueryResult
- Returns:
- an object representing the signature of the results, that can be used to
learn about the common structure of each
row
. This signature is usually aJsonObject
, but could also be any JSON-valid type like a boolean scalar,JsonArray
...
-
info
public AnalyticsMetrics info()
- Specified by:
info
in interfaceAnalyticsQueryResult
- Returns:
- an object describing some metrics/info about the execution of the query.
-
parseSuccess
public boolean parseSuccess()
- Specified by:
parseSuccess
in interfaceAnalyticsQueryResult
- Returns:
- true if the query could be parsed, false if it short-circuited due to syntax/fatal error.
-
errors
public List<JsonObject> errors()
- Specified by:
errors
in interfaceAnalyticsQueryResult
- Returns:
- A list of errors or warnings encountered while executing the query.
-
finalSuccess
public boolean finalSuccess()
Description copied from interface:AnalyticsQueryResult
Denotes the success or failure of the query. It could fail slower than withAnalyticsQueryResult.parseSuccess()
, for example if a fatal error comes up while streaming the results to the client. This method blocks until the query is over and the success can be established.- Specified by:
finalSuccess
in interfaceAnalyticsQueryResult
-
status
public String status()
Description copied from interface:AnalyticsQueryResult
Returns the final status of the query. For example, a successful query will return "success
" (which is equivalent toAnalyticsQueryResult.finalSuccess()
returning true). Other statuses include (but are not limited to) "fatal
" when fatal errors occurred and "timeout
" when the query timed out on the server side but not yet on the client side. This method blocks until the query is over and the status can be established.- Specified by:
status
in interfaceAnalyticsQueryResult
-
iterator
public Iterator<AnalyticsQueryRow> iterator()
- Specified by:
iterator
in interfaceIterable<AnalyticsQueryRow>
-
requestId
public String requestId()
- Specified by:
requestId
in interfaceAnalyticsQueryResult
- Returns:
- the requestId generated by the server
-
clientContextId
public String clientContextId()
- Specified by:
clientContextId
in interfaceAnalyticsQueryResult
- Returns:
- the clientContextId that was set by the client (could be truncated to 64 bytes of UTF-8 chars)
-
handle
public AnalyticsDeferredResultHandle handle()
- Specified by:
handle
in interfaceAnalyticsQueryResult
- Returns:
- the handle to fetch results from deferred execution
-
-