private void handleTargetClass(OInsertExecutionPlan result, OIdentifier targetClass, OCommandContext ctx, boolean profilingEnabled) { if (targetClass != null) { result.chain(new SetDocumentClassStep(targetClass, ctx, profilingEnabled)); } }
private void handleReturn(OInsertExecutionPlan result, OProjection returnStatement, OCommandContext ctx, boolean profilingEnabled) { if (returnStatement != null) { result.chain(new ProjectionCalculationStep(returnStatement, ctx, profilingEnabled)); } }
private void handleGlobalLet(OInsertExecutionPlan result, OIdentifier name, OExpression expression, OCommandContext ctx, boolean profilingEnabled) { result.chain(new GlobalLetExpressionStep(name, expression, ctx, profilingEnabled)); }
private void handleSave(OInsertExecutionPlan result, OIdentifier targetClusterName, OCommandContext ctx, boolean profilingEnabled) { result.chain(new SaveElementStep(ctx, targetClusterName, profilingEnabled)); }
private void handleSave(OInsertExecutionPlan result, OIdentifier targetClusterName, OCommandContext ctx, boolean profilingEnabled) { result.chain(new SaveElementStep(ctx, targetClusterName, profilingEnabled)); }
private void handleInsertSelect(OInsertExecutionPlan result, OSelectStatement selectStatement, OCommandContext ctx, boolean profilingEnabled) { OInternalExecutionPlan subPlan = selectStatement.createExecutionPlan(ctx, profilingEnabled); result.chain(new SubQueryStep(subPlan, ctx, ctx, profilingEnabled)); result.chain(new CopyDocumentStep(ctx, profilingEnabled)); result.chain(new RemoveEdgePointersStep(ctx, profilingEnabled)); }
private void handleCheckType(OInsertExecutionPlan result, OCommandContext ctx, boolean profilingEnabled) { if (targetClass != null) { result.chain(new CheckClassTypeStep(targetClass.getStringValue(), "V", ctx, profilingEnabled)); } if (targetClusterName != null) { result.chain(new CheckClusterTypeStep(targetClusterName.getStringValue(), "V", ctx, profilingEnabled)); } if (targetCluster != null) { result.chain(new CheckClusterTypeStep(targetCluster, "V", ctx, profilingEnabled)); } } }
private void handleCheckType(OInsertExecutionPlan result, OCommandContext ctx, boolean profilingEnabled) { if (targetClass != null) { result.chain(new CheckClassTypeStep(targetClass.getStringValue(), "E", ctx, profilingEnabled)); } }
private void handleCreateRecord(OInsertExecutionPlan result, OInsertBody body, OCommandContext ctx, boolean profilingEnabled) { int tot = 1; if (body != null && body.getValueExpressions() != null && body.getValueExpressions().size() > 0) { tot = body.getValueExpressions().size(); } result.chain(new CreateRecordStep(ctx, tot, profilingEnabled)); }
@Override public OInsertExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { OInsertExecutionPlan prev = super.createExecutionPlan(ctx, enableProfiling); List<OExecutionStep> steps = new ArrayList<>(prev.getSteps()); OInsertExecutionPlan result = new OInsertExecutionPlan(ctx); handleCheckType(result, ctx, enableProfiling); for (OExecutionStep step : steps) { result.chain((OExecutionStepInternal) step); } return result; }
private void handleSetFields(OInsertExecutionPlan result, OInsertBody insertBody, OCommandContext ctx, boolean profilingEnabled) { if (insertBody == null) { return; } if (insertBody.getIdentifierList() != null) { result.chain(new InsertValuesStep(insertBody.getIdentifierList(), insertBody.getValueExpressions(), ctx, profilingEnabled)); } else if (insertBody.getContent() != null) { result.chain(new UpdateContentStep(insertBody.getContent(), ctx, profilingEnabled)); } else if (insertBody.getContentInputParam() != null) { result.chain(new UpdateContentStep(insertBody.getContentInputParam(), ctx, profilingEnabled)); } else if (insertBody.getSetExpressions() != null) { List<OUpdateItem> items = new ArrayList<>(); for (OInsertSetExpression exp : insertBody.getSetExpressions()) { OUpdateItem item = new OUpdateItem(-1); item.setOperator(OUpdateItem.OPERATOR_EQ); item.setLeft(exp.getLeft().copy()); item.setRight(exp.getRight().copy()); items.add(item); } result.chain(new UpdateSetStep(items, ctx, profilingEnabled)); } }
private void handleSetFields(OInsertExecutionPlan result, OInsertBody insertBody, OCommandContext ctx, boolean profilingEnabled) { if (insertBody == null) { return; } if (insertBody.getIdentifierList() != null) { result.chain(new InsertValuesStep(insertBody.getIdentifierList(), insertBody.getValueExpressions(), ctx, profilingEnabled)); } else if (insertBody.getContent() != null) { result.chain(new UpdateContentStep(insertBody.getContent(), ctx, profilingEnabled)); } else if (insertBody.getContentInputParam() != null) { result.chain(new UpdateContentStep(insertBody.getContentInputParam(), ctx, profilingEnabled)); } else if (insertBody.getSetExpressions() != null) { List<OUpdateItem> items = new ArrayList<>(); for (OInsertSetExpression exp : insertBody.getSetExpressions()) { OUpdateItem item = new OUpdateItem(-1); item.setOperator(OUpdateItem.OPERATOR_EQ); item.setLeft(exp.getLeft().copy()); item.setRight(exp.getRight().copy()); items.add(item); } result.chain(new UpdateSetStep(items, ctx, profilingEnabled)); } }
result.chain( new CreateEdgesStep(targetClass, targetClusterName, uniqueIndexName, new OIdentifier("$__ORIENT_CREATE_EDGE_fromV"), new OIdentifier("$__ORIENT_CREATE_EDGE_toV"), wait, retry, batch, ctx, enableProfiling));
public OInsertExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { OInsertExecutionPlan result = new OInsertExecutionPlan(ctx); if (targetIndex != null) { result.chain(new InsertIntoIndexStep(targetIndex, insertBody, ctx, enableProfiling)); } else { if (selectStatement != null) { handleInsertSelect(result, this.selectStatement, ctx, enableProfiling); } else { handleCreateRecord(result, this.insertBody, ctx, enableProfiling); } handleTargetClass(result, targetClass, ctx, enableProfiling); handleSetFields(result, insertBody, ctx, enableProfiling); if (targetCluster != null) { String name = targetCluster.getClusterName(); if (name == null) { name = ctx.getDatabase().getClusterNameById(targetCluster.getClusterNumber()); } handleSave(result, new OIdentifier(name), ctx, enableProfiling); } else { handleSave(result, targetClusterName, ctx, enableProfiling); } handleReturn(result, returnStatement, ctx, enableProfiling); } return result; }