@Override public OExecutionStep copy(OCommandContext ctx) { return new ProjectionCalculationStep(projection.copy(), ctx, profilingEnabled); } }
@Override public OCreateVertexStatement copy() { OCreateVertexStatement result = null; try { result = getClass().getConstructor(Integer.TYPE).newInstance(-1); } catch (Exception e) { throw new RuntimeException(e); } result.targetClass = targetClass == null ? null : targetClass.copy(); result.targetClusterName = targetClusterName == null ? null : targetClusterName.copy(); result.targetCluster = targetCluster == null ? null : targetCluster.copy(); result.returnStatement = returnStatement == null ? null : returnStatement.copy(); result.insertBody = insertBody == null ? null : insertBody.copy(); return result; }
@Override public OUpdateStatement copy() { OUpdateStatement result = null; try { result = getClass().getConstructor(Integer.TYPE).newInstance(-1); } catch (Exception e) { throw new RuntimeException(e); } result.target = target == null ? null : target.copy(); result.operations = operations == null ? null : operations.stream().map(x -> x.copy()).collect(Collectors.toList()); result.upsert = upsert; result.returnBefore = returnBefore; result.returnAfter = returnAfter; result.returnProjection = returnProjection == null ? null : returnProjection.copy(); result.whereClause = whereClause == null ? null : whereClause.copy(); result.lockRecord = lockRecord; result.limit = limit == null ? null : limit.copy(); result.timeout = timeout == null ? null : timeout.copy(); return result; }
@Override public OUpdateEdgeStatement copy() { OUpdateEdgeStatement result = new OUpdateEdgeStatement(-1); result.target = target == null ? null : target.copy(); result.operations = operations == null ? null : operations.stream().map(x -> x.copy()).collect(Collectors.toList()); result.upsert = upsert; result.returnBefore = returnBefore; result.returnAfter = returnAfter; result.returnProjection = returnProjection == null ? null : returnProjection.copy(); result.whereClause = whereClause == null ? null : whereClause.copy(); result.lockRecord = lockRecord; result.limit = limit == null ? null : limit.copy(); result.timeout = timeout == null ? null : timeout.copy(); return result; }
@Override public OSelectStatement copy() { OSelectStatement result = null; try { result = getClass().getConstructor(Integer.TYPE).newInstance(-1); } catch (Exception e) { throw new RuntimeException(e); } result.originalStatement = originalStatement; result.target = target == null ? null : target.copy(); result.projection = projection == null ? null : projection.copy(); result.whereClause = whereClause == null ? null : whereClause.copy(); result.groupBy = groupBy == null ? null : groupBy.copy(); result.orderBy = orderBy == null ? null : orderBy.copy(); result.unwind = unwind == null ? null : unwind.copy(); result.skip = skip == null ? null : skip.copy(); result.limit = limit == null ? null : limit.copy(); result.lockRecord = lockRecord; result.fetchPlan = fetchPlan == null ? null : fetchPlan.copy(); result.letClause = letClause == null ? null : letClause.copy(); result.timeout = timeout == null ? null : timeout.copy(); result.parallel = parallel; result.noCache = noCache; return result; }
/** * for backward compatibility, translate "distinct(foo)" to "DISTINCT foo". This method modifies the projection itself. * * @param projection the projection */ protected static OProjection translateDistinct(OProjection projection) { if (projection != null && projection.getItems().size() == 1) { if (isDistinct(projection.getItems().get(0))) { projection = projection.copy(); OProjectionItem item = projection.getItems().get(0); OFunctionCall function = ((OBaseExpression) item.getExpression().getMathExpression()).getIdentifier().getLevelZero() .getFunctionCall(); OExpression exp = function.getParams().get(0); OProjectionItem resultItem = new OProjectionItem(-1); resultItem.setAlias(item.getAlias()); resultItem.setExpression(exp.copy()); OProjection result = new OProjection(-1); result.setItems(new ArrayList<>()); result.setDistinct(true); result.getItems().add(resultItem); return result; } } return projection; }
@Override public OInsertStatement copy() { OInsertStatement result = new OInsertStatement(-1); result.targetClass = targetClass == null ? null : targetClass.copy(); result.targetClusterName = targetClusterName == null ? null : targetClusterName.copy(); result.targetCluster = targetCluster == null ? null : targetCluster.copy(); result.targetIndex = targetIndex == null ? null : targetIndex.copy(); result.insertBody = insertBody == null ? null : insertBody.copy(); result.returnStatement = returnStatement == null ? null : returnStatement.copy(); result.selectStatement = selectStatement == null ? null : selectStatement.copy(); result.selectInParentheses = selectInParentheses; result.selectWithFrom = selectWithFrom; result.unsafe = unsafe; return result; }
public OUpdateExecutionPlanner(OUpdateStatement oUpdateStatement) { if (oUpdateStatement instanceof OUpdateEdgeStatement) { updateEdge = true; } this.target = oUpdateStatement.getTarget().copy(); this.whereClause = oUpdateStatement.getWhereClause() == null ? null : oUpdateStatement.getWhereClause().copy(); this.operations = oUpdateStatement.getOperations() == null ? null : oUpdateStatement.getOperations().stream().map(x -> x.copy()).collect(Collectors.toList()); this.upsert = oUpdateStatement.isUpsert(); this.returnBefore = oUpdateStatement.isReturnBefore(); this.returnAfter = oUpdateStatement.isReturnAfter(); this.returnCount = !(returnAfter || returnBefore); this.returnProjection = oUpdateStatement.getReturnProjection() == null ? null : oUpdateStatement.getReturnProjection().copy(); this.lockRecord = oUpdateStatement.getLockRecord(); this.limit = oUpdateStatement.getLimit() == null ? null : oUpdateStatement.getLimit().copy(); this.timeout = oUpdateStatement.getTimeout() == null ? null : oUpdateStatement.getTimeout().copy(); }
public OCreateVertexExecutionPlanner(OCreateVertexStatement statement) { this.targetClass = statement.getTargetClass() == null ? null : statement.getTargetClass().copy(); this.targetClusterName = statement.getTargetClusterName() == null ? null : statement.getTargetClusterName().copy(); this.targetCluster = statement.getTargetCluster() == null ? null : statement.getTargetCluster().copy(); if (this.targetClass == null && this.targetCluster == null && this.targetClusterName == null) { this.targetClass = new OIdentifier("V"); } this.insertBody = statement.getInsertBody() == null ? null : statement.getInsertBody().copy(); this.returnStatement = statement.getReturnStatement() == null ? null : statement.getReturnStatement().copy(); }
public OInsertExecutionPlanner(OInsertStatement statement) { this.targetClass = statement.getTargetClass() == null ? null : statement.getTargetClass().copy(); this.targetClusterName = statement.getTargetClusterName() == null ? null : statement.getTargetClusterName().copy(); this.targetCluster = statement.getTargetCluster() == null ? null : statement.getTargetCluster().copy(); this.targetIndex = statement.getTargetIndex() == null ? null : statement.getTargetIndex().copy(); this.insertBody = statement.getInsertBody() == null ? null : statement.getInsertBody().copy(); this.returnStatement = statement.getReturnStatement() == null ? null : statement.getReturnStatement().copy(); this.selectStatement = statement.getSelectStatement() == null ? null : statement.getSelectStatement().copy(); }
private void init() { //copying the content, so that it can be manipulated and optimized info = new QueryPlanningInfo(); info.projection = this.statement.getProjection() == null ? null : this.statement.getProjection().copy(); info.projection = translateDistinct(info.projection); info.distinct = info.projection == null ? false : info.projection.isDistinct(); if (info.projection != null) { info.projection.setDistinct(false); } info.target = this.statement.getTarget(); info.whereClause = this.statement.getWhereClause() == null ? null : this.statement.getWhereClause().copy(); info.whereClause = translateLucene(info.whereClause); info.perRecordLetClause = this.statement.getLetClause() == null ? null : this.statement.getLetClause().copy(); info.groupBy = this.statement.getGroupBy() == null ? null : this.statement.getGroupBy().copy(); info.orderBy = this.statement.getOrderBy() == null ? null : this.statement.getOrderBy().copy(); info.unwind = this.statement.getUnwind() == null ? null : this.statement.getUnwind().copy(); info.skip = this.statement.getSkip(); info.limit = this.statement.getLimit(); info.lockRecord = this.statement.getLockRecord(); }