use of cn.edu.tsinghua.iginx.engine.physical.task.TaskExecuteResult in project IginX by thulab.
the class MemoryPhysicalTaskDispatcher method startDispatcher.
public void startDispatcher() {
taskDispatcher.submit(() -> {
while (true) {
final MemoryPhysicalTask task = taskQueue.getTask();
taskExecuteThreadPool.submit(() -> {
MemoryPhysicalTask currentTask = task;
while (currentTask != null) {
TaskExecuteResult result;
try {
result = currentTask.execute();
} catch (Exception e) {
logger.error("execute memory task failure: ", e);
result = new TaskExecuteResult(new PhysicalException(e));
}
currentTask.setResult(result);
if (currentTask.getFollowerTask() != null) {
// 链式执行可以被执行的任务
MemoryPhysicalTask followerTask = (MemoryPhysicalTask) currentTask.getFollowerTask();
if (followerTask.notifyParentReady()) {
currentTask = followerTask;
} else {
currentTask = null;
}
} else {
currentTask = null;
}
}
});
}
});
}
use of cn.edu.tsinghua.iginx.engine.physical.task.TaskExecuteResult in project IginX by thulab.
the class IoTDBStorage method executeInsertTask.
private TaskExecuteResult executeInsertTask(String storageUnit, Insert insert) {
DataView dataView = insert.getData();
Exception e = null;
switch(dataView.getRawDataType()) {
case Row:
e = insertRowRecords((RowDataView) dataView, storageUnit);
break;
case Column:
e = insertColumnRecords((ColumnDataView) dataView, storageUnit);
break;
case NonAlignedRow:
e = insertNonAlignedRowRecords((RowDataView) dataView, storageUnit);
break;
case NonAlignedColumn:
e = insertNonAlignedColumnRecords((ColumnDataView) dataView, storageUnit);
break;
}
if (e != null) {
return new TaskExecuteResult(null, new PhysicalException("execute insert task in iotdb12 failure", e));
}
return new TaskExecuteResult(null, null);
}
use of cn.edu.tsinghua.iginx.engine.physical.task.TaskExecuteResult in project IginX by thulab.
the class IoTDBStorage method execute.
@Override
public TaskExecuteResult execute(StoragePhysicalTask task) {
List<Operator> operators = task.getOperators();
if (operators.size() < 1) {
return new TaskExecuteResult(new NonExecutablePhysicalTaskException("storage physical task should have one more operators"));
}
Operator op = operators.get(0);
String storageUnit = task.getStorageUnit();
if (op.getType() == OperatorType.Project) {
Project project = (Project) op;
Filter filter;
if (operators.size() == 2) {
filter = ((Select) operators.get(1)).getFilter();
} else {
FragmentMeta fragment = task.getTargetFragment();
filter = new AndFilter(Arrays.asList(new TimeFilter(Op.GE, fragment.getTimeInterval().getStartTime()), new TimeFilter(Op.L, fragment.getTimeInterval().getEndTime())));
}
return executeQueryTask(storageUnit, project, filter);
} else if (op.getType() == OperatorType.Insert) {
Insert insert = (Insert) op;
return executeInsertTask(storageUnit, insert);
} else if (op.getType() == OperatorType.Delete) {
Delete delete = (Delete) op;
return executeDeleteTask(storageUnit, delete);
}
return new TaskExecuteResult(new NonExecutablePhysicalTaskException("unsupported physical task"));
}
use of cn.edu.tsinghua.iginx.engine.physical.task.TaskExecuteResult in project IginX by thulab.
the class OpenTSDBStorage method execute.
@Override
public TaskExecuteResult execute(StoragePhysicalTask task) {
List<Operator> operators = task.getOperators();
if (operators.size() != 1) {
return new TaskExecuteResult(new NonExecutablePhysicalTaskException("unsupported physical task"));
}
FragmentMeta fragment = task.getTargetFragment();
Operator op = operators.get(0);
String storageUnit = task.getStorageUnit();
if (op.getType() == OperatorType.Project) {
Project project = (Project) op;
return executeProjectTask(fragment.getTimeInterval(), storageUnit, project);
} else if (op.getType() == OperatorType.Insert) {
Insert insert = (Insert) op;
return executeInsertTask(storageUnit, insert);
} else if (op.getType() == OperatorType.Delete) {
Delete delete = (Delete) op;
return executeDeleteTask(storageUnit, delete);
}
return new TaskExecuteResult(new NonExecutablePhysicalTaskException("unsupported physical task"));
}
use of cn.edu.tsinghua.iginx.engine.physical.task.TaskExecuteResult in project IginX by thulab.
the class OpenTSDBStorage method executeInsertTask.
private TaskExecuteResult executeInsertTask(String storageUnit, Insert insert) {
DataView dataView = insert.getData();
Exception e = null;
switch(dataView.getRawDataType()) {
case Row:
case NonAlignedRow:
e = insertRowRecords((RowDataView) dataView, storageUnit);
break;
case Column:
case NonAlignedColumn:
e = insertColRecords((ColumnDataView) dataView, storageUnit);
}
if (e != null) {
return new TaskExecuteResult(null, new PhysicalException("execute insert task in opentsdb failure", e));
}
return new TaskExecuteResult(null, null);
}
Aggregations