Class DirectStatement

java.lang.Object
org.apache.druid.sql.AbstractStatement
org.apache.druid.sql.DirectStatement
All Implemented Interfaces:
Closeable, AutoCloseable, SqlLifecycleManager.Cancelable
Direct Known Subclasses:
HttpStatement

public class DirectStatement extends AbstractStatement implements SqlLifecycleManager.Cancelable
Lifecycle for direct SQL statement execution, which means that the query is planned and executed in a single step, with no "prepare" step. Callers need call only:

The cancel() method may be called from any thread and cancels the query.

All other methods are optional and are generally for introspection.

The class supports two threading models. In the simple case, the same thread creates this object and executes the query. In the split model, a request thread creates this object and plans the query. A separate response thread consumes results and performs any desired logging, etc. The object is transferred between threads, with no overlapping access.

As statement holds no resources and need not be called. Only the Sequence returned from execute() need be closed.

Use this class for tests and JDBC execution. Use the HTTP variant, HttpStatement for HTTP requests.