@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; }
@Override public void reset(OCommandContext ctx) { result.clear(); next = 0; super.reset(ctx); executeInternal(); }
public OInsertExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { OInsertExecutionPlanner planner = new OInsertExecutionPlanner(this); OInsertExecutionPlan result = planner.createExecutionPlan(ctx, enableProfiling); result.setStatement(originalStatement); return result; }
private void handleTargetClass(OInsertExecutionPlan result, OIdentifier targetClass, OCommandContext ctx, boolean profilingEnabled) { if (targetClass != null) { result.chain(new SetDocumentClassStep(targetClass, ctx, profilingEnabled)); } }
OInsertExecutionPlan result = new OInsertExecutionPlan(ctx); result.chain( new CreateEdgesStep(targetClass, targetClusterName, uniqueIndexName, new OIdentifier("$__ORIENT_CREATE_EDGE_fromV"), new OIdentifier("$__ORIENT_CREATE_EDGE_toV"), wait, retry, batch, ctx, enableProfiling)); if (useCache && !enableProfiling && statement.executinPlanCanBeCached() && result.canBeCached() && OExecutionPlanCache.getLastInvalidation(db) < planningStart) { OExecutionPlanCache.put(statement.getOriginalStatement(), result, (ODatabaseDocumentInternal) ctx.getDatabase());
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; }
@Override public OInternalExecutionPlan copy(OCommandContext ctx) { OInsertExecutionPlan copy = new OInsertExecutionPlan(ctx); super.copyOn(copy, ctx); return copy; }
private void handleGlobalLet(OInsertExecutionPlan result, OIdentifier name, OExpression expression, OCommandContext ctx, boolean profilingEnabled) { result.chain(new GlobalLetExpressionStep(name, expression, ctx, profilingEnabled)); }
private void handleReturn(OInsertExecutionPlan result, OProjection returnStatement, OCommandContext ctx, boolean profilingEnabled) { if (returnStatement != null) { result.chain(new ProjectionCalculationStep(returnStatement, ctx, profilingEnabled)); } }
@Override public OResultSet execute(ODatabase db, Object[] args, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); Map<Object, Object> params = new HashMap<>(); if (args != null) { for (int i = 0; i < args.length; i++) { params.put(i, args[i]); } } ctx.setInputParameters(params); OInsertExecutionPlan executionPlan = (OInsertExecutionPlan) createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
public OInsertExecutionPlan createExecutionPlan(OCommandContext ctx, boolean enableProfiling) { OCreateEdgeExecutionPlanner planner = new OCreateEdgeExecutionPlanner(this); OInsertExecutionPlan result = planner.createExecutionPlan(ctx, enableProfiling, true); result.setStatement(this.originalStatement); return result; }
private void handleSave(OInsertExecutionPlan result, OIdentifier targetClusterName, OCommandContext ctx, boolean profilingEnabled) { result.chain(new SaveElementStep(ctx, targetClusterName, profilingEnabled)); }
@Override public OResultSet execute(ODatabase db, Object[] args, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); Map<Object, Object> params = new HashMap<>(); if (args != null) { for (int i = 0; i < args.length; i++) { params.put(i, args[i]); } } ctx.setInputParameters(params); OInsertExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
public OInsertExecutionPlan createExecutionPlanNoCache(OCommandContext ctx, boolean enableProfiling) { OCreateEdgeExecutionPlanner planner = new OCreateEdgeExecutionPlanner(this); OInsertExecutionPlan result = planner.createExecutionPlan(ctx, enableProfiling, false); result.setStatement(this.originalStatement); return result; }
private void handleSave(OInsertExecutionPlan result, OIdentifier targetClusterName, OCommandContext ctx, boolean profilingEnabled) { result.chain(new SaveElementStep(ctx, targetClusterName, profilingEnabled)); }
@Override public OResultSet execute(ODatabase db, Object[] args, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); Map<Object, Object> params = new HashMap<>(); if (args != null) { for (int i = 0; i < args.length; i++) { params.put(i, args[i]); } } ctx.setInputParameters(params); OInsertExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
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)); }
@Override public OResultSet execute(ODatabase db, Map params, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); ctx.setInputParameters(params); OInsertExecutionPlan executionPlan = createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }
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)); } } }
@Override public OResultSet execute(ODatabase db, Map params, OCommandContext parentCtx) { OBasicCommandContext ctx = new OBasicCommandContext(); if (parentCtx != null) { ctx.setParentWithoutOverridingChild(parentCtx); } ctx.setDatabase(db); ctx.setInputParameters(params); OInsertExecutionPlan executionPlan = (OInsertExecutionPlan) createExecutionPlan(ctx, false); executionPlan.executeInternal(); return new OLocalResultSet(executionPlan); }