@Override public QueryPlan getQueryPlan() { return plan.getQueryPlan(); }
@Override public MutationState updateData(MutationPlan plan) throws SQLException { MutationState state = plan.execute(); plan.getContext().getConnection().commit(); return state; }
@Override public Long getEstimateInfoTimestamp() throws SQLException { return plan.getEstimateInfoTimestamp(); }
public boolean checkpointIfNeccessary(MutationPlan plan) throws SQLException { if (!phoenixTransactionContext.isTransactionRunning() || plan.getTargetRef() == null || plan.getTargetRef().getTable() == null || !plan.getTargetRef().getTable().isTransactional()) { return false; } Set<TableRef> sources = plan.getSourceRefs(); if (sources.isEmpty()) { return false; } TableRef ignoreForExcludeCurrent = plan.getOperation() == Operation.DELETE && sources.size() == 1 ? plan .getTargetRef() : null; boolean excludeCurrent = false; String targetPhysicalName = plan.getTargetRef().getTable().getPhysicalName().getString(); for (TableRef source : sources) { if (source.getTable().isTransactional() && !source.equals(ignoreForExcludeCurrent)) {
@Override public StatementContext getContext() { return plan.getContext(); }
@Override public MutationState execute() throws SQLException { return plan.execute(); }
@Override public ParameterMetaData getParameterMetaData() { return plan.getParameterMetaData(); }
@Override public ExplainPlan getExplainPlan() throws SQLException { return plan.getExplainPlan(); }
@Override public Set<TableRef> getSourceRefs() { return plan.getSourceRefs(); }
@Override public Long getEstimatedRowsToScan() throws SQLException { return plan.getEstimatedRowsToScan(); }
@Override public Long getEstimatedBytesToScan() throws SQLException { return plan.getEstimatedBytesToScan(); }
@Override public Operation getOperation() { return plan.getOperation(); }
public boolean checkpointIfNeccessary(MutationPlan plan) throws SQLException { if (!phoenixTransactionContext.isTransactionRunning() || plan.getTargetRef() == null || plan.getTargetRef().getTable() == null || !plan.getTargetRef().getTable().isTransactional()) { return false; } Set<TableRef> sources = plan.getSourceRefs(); if (sources.isEmpty()) { return false; } TableRef ignoreForExcludeCurrent = plan.getOperation() == Operation.DELETE && sources.size() == 1 ? plan .getTargetRef() : null; boolean excludeCurrent = false; String targetPhysicalName = plan.getTargetRef().getTable().getPhysicalName().getString(); for (TableRef source : sources) { if (source.getTable().isTransactional() && !source.equals(ignoreForExcludeCurrent)) {
@Override public StatementContext getContext() { return firstPlan.getContext(); }
@Override public MutationState execute() throws SQLException { MutationState state = firstPlan.execute(); statement.getConnection().getMutationState().join(state); for (MutationPlan plan : plans.subList(1, plans.size())) { statement.getConnection().getMutationState().join(plan.execute()); } return state; }
@Override public ParameterMetaData getParameterMetaData() { return firstPlan.getParameterMetaData(); }
@Override public ExplainPlan getExplainPlan() throws SQLException { return firstPlan.getExplainPlan(); }
@Override public Set<TableRef> getSourceRefs() { return firstPlan.getSourceRefs(); }
@Override public Long getEstimatedRowsToScan() throws SQLException { Long estRows = null; for (MutationPlan plan : plans) { /* * If any of the plan doesn't have estimate information available, then we cannot * provide estimate for the overall plan. */ if (plan.getEstimatedRowsToScan() == null) { return null; } estRows = add(estRows, plan.getEstimatedRowsToScan()); } return estRows; }
@Override public Long getEstimatedBytesToScan() throws SQLException { Long estBytes = null; for (MutationPlan plan : plans) { /* * If any of the plan doesn't have estimate information available, then we cannot * provide estimate for the overall plan. */ if (plan.getEstimatedBytesToScan() == null) { return null; } estBytes = add(estBytes, plan.getEstimatedBytesToScan()); } return estBytes; }