public OInsertBody copy() { OInsertBody result = new OInsertBody(-1); result.identifierList = identifierList == null ? null : identifierList.stream().map(x -> x.copy()).collect(Collectors.toList()); result.valueExpressions = valueExpressions == null ? null : valueExpressions.stream().map(sub -> sub.stream().map(x -> x.copy()).collect(Collectors.toList())) .collect(Collectors.toList()); result.setExpressions = setExpressions == null ? null : setExpressions.stream().map(x -> x.copy()).collect(Collectors.toList()); result.content = content == null ? null : content.copy(); result.contentInputParam = contentInputParam == null ? null : contentInputParam.copy(); return result; }
@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 boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OCreateVertexStatement that = (OCreateVertexStatement) o; if (targetClass != null ? !targetClass.equals(that.targetClass) : that.targetClass != null) return false; if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) return false; if (targetCluster != null ? !targetCluster.equals(that.targetCluster) : that.targetCluster != null) return false; if (returnStatement != null ? !returnStatement.equals(that.returnStatement) : that.returnStatement != null) return false; if (insertBody != null ? !insertBody.equals(that.insertBody) : that.insertBody != null) return false; return true; }
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)); } }
final public OInsertBody InsertBody() throws ParseException { OInsertBody jjtn000 = new OInsertBody(JJTINSERTBODY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));OIdentifier lastIdentifier; OExpression lastExpression; List<OExpression> lastExpressionList; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0));
@Override public int hashCode() { int result = targetClass != null ? targetClass.hashCode() : 0; result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); result = 31 * result + (upsert ? 1 : 0); result = 31 * result + (leftExpression != null ? leftExpression.hashCode() : 0); result = 31 * result + (rightExpression != null ? rightExpression.hashCode() : 0); result = 31 * result + (body != null ? body.hashCode() : 0); result = 31 * result + (retry != null ? retry.hashCode() : 0); result = 31 * result + (wait != null ? wait.hashCode() : 0); result = 31 * result + (batch != null ? batch.hashCode() : 0); return result; }
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 boolean executinPlanCanBeCached() { if (this.leftExpression != null && !this.leftExpression.isCacheable()) { return false; } if (this.rightExpression != null && !this.rightExpression.isCacheable()) { return false; } if (this.body != null && !body.isCacheable()) { return false; } return true; }
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)); } }
@Override public int hashCode() { int result = targetClass != null ? targetClass.hashCode() : 0; result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); result = 31 * result + (targetCluster != null ? targetCluster.hashCode() : 0); result = 31 * result + (returnStatement != null ? returnStatement.hashCode() : 0); result = 31 * result + (insertBody != null ? insertBody.hashCode() : 0); return result; }
@Override public OResult next() { if (!hasNext()) { throw new IllegalStateException(); } //TODO OIndex<?> index = ctx.getDatabase().getMetadata().getIndexManager().getIndex(targetIndex.getIndexName()); if (index == null) { throw new OCommandExecutionException("Index not found: " + targetIndex); } List<OInsertSetExpression> setExps = body.getSetExpressions(); if (body.getContent() != null) { throw new OCommandExecutionException("Invalid expression: INSERT INTO INDEX:... CONTENT ..."); } int count; if (setExps != null) { count = handleSet(setExps, index, ctx); } else { count = handleKeyValues(body.getIdentifierList(), body.getValueExpressions(), index, ctx); } executed = true; OResultInternal result = new OResultInternal(); result.setProperty("count", count); return result; }
@Override public OCreateEdgeStatement copy() { OCreateEdgeStatement 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.upsert = this.upsert; result.leftExpression = leftExpression == null ? null : leftExpression.copy(); result.rightExpression = rightExpression == null ? null : rightExpression.copy(); result.body = body == null ? null : body.copy(); result.retry = retry; result.wait = wait; result.batch = batch == null ? null : batch.copy(); return result; }
@Override public int hashCode() { int result = targetClass != null ? targetClass.hashCode() : 0; result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0); result = 31 * result + (targetCluster != null ? targetCluster.hashCode() : 0); result = 31 * result + (targetIndex != null ? targetIndex.hashCode() : 0); result = 31 * result + (insertBody != null ? insertBody.hashCode() : 0); result = 31 * result + (returnStatement != null ? returnStatement.hashCode() : 0); result = 31 * result + (selectStatement != null ? selectStatement.hashCode() : 0); result = 31 * result + (selectInParentheses ? 1 : 0); result = 31 * result + (selectWithFrom ? 1 : 0); result = 31 * result + (unsafe ? 1 : 0); return result; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OCreateEdgeStatement that = (OCreateEdgeStatement) o; if (upsert != that.upsert) return false; if (targetClass != null ? !targetClass.equals(that.targetClass) : that.targetClass != null) return false; if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) return false; if (leftExpression != null ? !leftExpression.equals(that.leftExpression) : that.leftExpression != null) return false; if (rightExpression != null ? !rightExpression.equals(that.rightExpression) : that.rightExpression != null) return false; if (body != null ? !body.equals(that.body) : that.body != null) return false; if (retry != null ? !retry.equals(that.retry) : that.retry != null) return false; if (wait != null ? !wait.equals(that.wait) : that.wait != null) return false; return batch != null ? batch.equals(that.batch) : that.batch == null; }
@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; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OInsertStatement that = (OInsertStatement) o; if (selectInParentheses != that.selectInParentheses) return false; if (selectWithFrom != that.selectWithFrom) return false; if (unsafe != that.unsafe) return false; if (targetClass != null ? !targetClass.equals(that.targetClass) : that.targetClass != null) return false; if (targetClusterName != null ? !targetClusterName.equals(that.targetClusterName) : that.targetClusterName != null) return false; if (targetCluster != null ? !targetCluster.equals(that.targetCluster) : that.targetCluster != null) return false; if (targetIndex != null ? !targetIndex.equals(that.targetIndex) : that.targetIndex != null) return false; if (insertBody != null ? !insertBody.equals(that.insertBody) : that.insertBody != null) return false; if (returnStatement != null ? !returnStatement.equals(that.returnStatement) : that.returnStatement != null) return false; if (selectStatement != null ? !selectStatement.equals(that.selectStatement) : that.selectStatement != null) return false; return true; }
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(); }
public OCreateEdgeExecutionPlanner(OCreateEdgeStatement statement) { this.statement = statement; this.targetClass = statement.getTargetClass() == null ? null : statement.getTargetClass().copy(); this.targetClusterName = statement.getTargetClusterName() == null ? null : statement.getTargetClusterName().copy(); this.leftExpression = statement.getLeftExpression() == null ? null : statement.getLeftExpression().copy(); this.rightExpression = statement.getRightExpression() == null ? null : statement.getRightExpression().copy(); this.upsert = statement.isUpsert(); this.body = statement.getBody() == null ? null : statement.getBody().copy(); this.retry = statement.getRetry(); this.wait = statement.getWait(); this.batch = statement.getBatch() == null ? null : statement.getBatch().copy(); }