Class QueryExecution

  • All Implemented Interfaces:
    IQueryExecution

    public class QueryExecution
    extends java.lang.Object
    implements IQueryExecution
    QueryExecution stores all the status of a query which is being prepared or running inside the MPP frame. It takes three main responsibilities: 1. Prepare a query. Transform a query from statement to DistributedQueryPlan with fragment instances. 2. Dispatch all the fragment instances to corresponding physical nodes. 3. Collect and monitor the progress/states of this query.
    • Constructor Detail

      • QueryExecution

        public QueryExecution​(Statement statement,
                              MPPQueryContext context,
                              java.util.concurrent.ExecutorService executor,
                              java.util.concurrent.ExecutorService writeOperationExecutor,
                              java.util.concurrent.ScheduledExecutorService scheduledExecutor,
                              IPartitionFetcher partitionFetcher,
                              ISchemaFetcher schemaFetcher,
                              org.apache.iotdb.commons.client.IClientManager<org.apache.iotdb.common.rpc.thrift.TEndPoint,​org.apache.iotdb.commons.client.sync.SyncDataNodeInternalServiceClient> internalServiceClientManager)
    • Method Detail

      • doLogicalPlan

        public void doLogicalPlan()
      • doDistributedPlan

        public void doDistributedPlan()
      • getBatchResult

        public java.util.Optional<org.apache.iotdb.tsfile.read.common.block.TsBlock> getBatchResult()
                                                                                             throws org.apache.iotdb.commons.exception.IoTDBException
        This method will be called by the request thread from client connection. This method will block until one of these conditions occurs: 1. There is a batch of result 2. There is no more result 3. The query has been cancelled 4. The query is timeout This method will fetch the result from DataStreamManager use the virtual ResultOperator's ID (This part will be designed and implemented with DataStreamManager)
        Specified by:
        getBatchResult in interface IQueryExecution
        Throws:
        org.apache.iotdb.commons.exception.IoTDBException
      • hasNextResult

        public boolean hasNextResult()
        Specified by:
        hasNextResult in interface IQueryExecution
        Returns:
        true if there is more tsblocks, otherwise false
      • getStatus

        public ExecutionResult getStatus()
        This method is a synchronized method. For READ, it will block until all the FragmentInstances have been submitted. For WRITE, it will block until all the FragmentInstances have finished.
        Specified by:
        getStatus in interface IQueryExecution
        Returns:
        ExecutionStatus. Contains the QueryId and the TSStatus.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object