Class OnlineQueryMultiResult

java.lang.Object
ai.chalk.models.OnlineQueryMultiResult
All Implemented Interfaces:
AutoCloseable

public class OnlineQueryMultiResult extends Object implements AutoCloseable
OnlineQueryMultiResult holds the results of a multi-query, i.e. several independent online queries executed in parallel by a single request.

Closing this object closes every sub-result and releases all Arrow memory associated with the request. Callers should use try-with-resources and should not close the individual OnlineQueryResults returned by getResults().

  • Constructor Details

  • Method Details

    • close

      public void close()
      close releases the resources associated with every sub-result. It is idempotent. If closing a sub-result fails, the remaining sub-results are still closed and the first failure is thrown with the rest attached as suppressed exceptions.
      Specified by:
      close in interface AutoCloseable
    • getResults

      public List<OnlineQueryResult> getResults()
      results holds one OnlineQueryResult per sub-query, in the same order the queries were passed in. Errors that pertain to a specific sub-query are found on that sub-query's result, via OnlineQueryResult.getErrors().

      Each result owns its own Arrow allocator, which is released when this object is closed.

      This list is 1:1 with the queries that were submitted, with one exception: if the request failed before any sub-query was dispatched, this list is empty and getGlobalErrors() explains why.

    • getGlobalErrors

      public ServerError[] getGlobalErrors()
      globalErrors holds the errors that the engine did not attach to a specific sub-query's result. A resolver that fails while computing a sub-query is reported on that sub-query's own result instead, so most errors are not global.

      An error here is not necessarily unrelated to a particular sub-query. When a sub-query fails to execute at all -- it was rate limited, or the engine hit a transport or internal error running it -- the engine records the failure here and names the sub-query by its 1-based position in the message text, e.g. "... while executing query 2/3: ...". That sub-query still occupies its slot in getResults(), but the result is empty and reports no errors of its own. So an empty result is not proof of success: check this list too before concluding that every sub-query ran.

    • getTraceId

      public String getTraceId()
      traceId is the trace ID of the single underlying request, and is therefore shared by every sub-query.