Class QueryExecution
- java.lang.Object
-
- org.apache.iotdb.db.mpp.plan.execution.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 Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoDistributedPlan()voiddoLogicalPlan()java.util.Optional<org.apache.iotdb.tsfile.read.common.block.TsBlock>getBatchResult()This method will be called by the request thread from client connection.DatasetHeadergetDatasetHeader()DistributedQueryPlangetDistributedPlan()LogicalQueryPlangetLogicalPlan()intgetOutputValueColumnCount()return the result column count without the time columnjava.lang.StringgetQueryId()ExecutionResultgetStatus()This method is a synchronized method.booleanhasNextResult()booleanisQuery()voidstart()voidstop()voidstopAndCleanup()java.lang.StringtoString()
-
-
-
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
-
start
public void start()
- Specified by:
startin interfaceIQueryExecution
-
doLogicalPlan
public void doLogicalPlan()
-
doDistributedPlan
public void doDistributedPlan()
-
stop
public void stop()
- Specified by:
stopin interfaceIQueryExecution
-
stopAndCleanup
public void stopAndCleanup()
- Specified by:
stopAndCleanupin interfaceIQueryExecution
-
getBatchResult
public java.util.Optional<org.apache.iotdb.tsfile.read.common.block.TsBlock> getBatchResult() throws org.apache.iotdb.commons.exception.IoTDBExceptionThis 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:
getBatchResultin interfaceIQueryExecution- Throws:
org.apache.iotdb.commons.exception.IoTDBException
-
hasNextResult
public boolean hasNextResult()
- Specified by:
hasNextResultin interfaceIQueryExecution- Returns:
- true if there is more tsblocks, otherwise false
-
getOutputValueColumnCount
public int getOutputValueColumnCount()
return the result column count without the time column- Specified by:
getOutputValueColumnCountin interfaceIQueryExecution
-
getDatasetHeader
public DatasetHeader getDatasetHeader()
- Specified by:
getDatasetHeaderin interfaceIQueryExecution
-
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:
getStatusin interfaceIQueryExecution- Returns:
- ExecutionStatus. Contains the QueryId and the TSStatus.
-
getDistributedPlan
public DistributedQueryPlan getDistributedPlan()
-
getLogicalPlan
public LogicalQueryPlan getLogicalPlan()
-
isQuery
public boolean isQuery()
- Specified by:
isQueryin interfaceIQueryExecution
-
getQueryId
public java.lang.String getQueryId()
- Specified by:
getQueryIdin interfaceIQueryExecution
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-