@Override public Expression visit(SequenceValueParseNode node) throws SQLException { return context.getSequenceManager().newSequenceReference(node); } }
@Override public ExplainPlan getExplainPlan() throws SQLException { List<String> planSteps = Lists.newArrayListWithExpectedSize(2); if (context.getSequenceManager().getSequenceCount() > 0) { planSteps.add("CLIENT RESERVE " + context.getSequenceManager().getSequenceCount() + " SEQUENCES"); } planSteps.add("PUT SINGLE ROW"); return new ExplainPlan(planSteps); }
if (context.getSequenceManager().getSequenceCount() > 0) { scanner = new SequenceResultIterator(scanner, context.getSequenceManager());
@Override public ExplainPlan getExplainPlan() throws SQLException { List<String> planSteps = Lists.newArrayList(delegate.getExplainPlan().getPlanSteps()); if (where != null) { planSteps.add("CLIENT FILTER BY " + where.toString()); } if (!orderBy.getOrderByExpressions().isEmpty()) { if (offset != null) { planSteps.add("CLIENT OFFSET " + offset); } planSteps.add("CLIENT" + (limit == null ? "" : " TOP " + limit + " ROW" + (limit == 1 ? "" : "S")) + " SORTED BY " + orderBy.getOrderByExpressions().toString()); } else { if (offset != null) { planSteps.add("CLIENT OFFSET " + offset); } if (limit != null) { planSteps.add("CLIENT " + limit + " ROW LIMIT"); } } if (context.getSequenceManager().getSequenceCount() > 0) { int nSequences = context.getSequenceManager().getSequenceCount(); planSteps.add("CLIENT RESERVE VALUES FROM " + nSequences + " SEQUENCE" + (nSequences == 1 ? "" : "S")); } return new ExplainPlan(planSteps); }
planSteps.add("CLIENT" + (limit == null ? "" : " TOP " + limit + " ROW" + (limit == 1 ? "" : "S")) + " SORTED BY " + orderBy.getOrderByExpressions().toString()); if (context.getSequenceManager().getSequenceCount() > 0) { int nSequences = context.getSequenceManager().getSequenceCount(); planSteps.add("CLIENT RESERVE VALUES FROM " + nSequences + " SEQUENCE" + (nSequences == 1 ? "" : "S"));
@Override protected MutationState mutate(StatementContext parentContext, ResultIterator iterator, PhoenixConnection connection) throws SQLException { if (parentContext.getSequenceManager().getSequenceCount() > 0) { throw new IllegalStateException("Cannot pipeline upsert when sequence is referenced"); } PhoenixStatement statement = new PhoenixStatement(connection); /* * We don't want to collect any read metrics within the child context. This is because any read metrics that * need to be captured are already getting collected in the parent statement context enclosed in the result * iterator being used for reading rows out. */ StatementContext childContext = new StatementContext(statement, false); // Clone the row projector as it's not thread safe and would be used simultaneously by // multiple threads otherwise. MutationState state = upsertSelect(childContext, tableRef, projector.cloneIfNecessary(), iterator, columnIndexes, pkSlotIndexes, useSeverTimestamp, false); return state; }
@SuppressWarnings("unchecked") @Override public MutationPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException { if(!getUdfParseNodes().isEmpty()) { stmt.throwIfUnallowedUserDefinedFunctions(getUdfParseNodes()); } UpsertCompiler compiler = new UpsertCompiler(stmt, this.getOperation()); MutationPlan plan = compiler.compile(this); plan.getContext().getSequenceManager().validateSequences(seqAction); return plan; } }
@SuppressWarnings("unchecked") @Override public MutationPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException { if(!getUdfParseNodes().isEmpty()) { stmt.throwIfUnallowedUserDefinedFunctions(getUdfParseNodes()); } DeleteCompiler compiler = new DeleteCompiler(stmt, this.getOperation()); MutationPlan plan = compiler.compile(this); plan.getContext().getSequenceManager().validateSequences(seqAction); return plan; } }
? RoundRobinResultIterator.newIterator(iterators, queryPlan) : ConcatResultIterator.newIterator(iterators); if (queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext() .getSequenceManager());
@Override public ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { ResultIterator iterator = delegate.iterator(scanGrouper, scan); if (where != null) { iterator = new FilterResultIterator(iterator, where); } if (!orderBy.getOrderByExpressions().isEmpty()) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); iterator = new OrderedResultIterator(iterator, orderBy.getOrderByExpressions(), thresholdBytes, limit, offset, projector.getEstimatedRowByteSize()); } else { if (offset != null) { iterator = new OffsetResultIterator(iterator, offset); } if (limit != null) { iterator = new LimitingResultIterator(iterator, limit); } } if (context.getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, context.getSequenceManager()); } return iterator; }
@Override public Expression visit(SequenceValueParseNode node) throws SQLException { if (aggregateFunction != null) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.INVALID_USE_OF_NEXT_VALUE_FOR) .setSchemaName(node.getTableName().getSchemaName()) .setTableName(node.getTableName().getTableName()).build().buildException(); } return context.getSequenceManager().newSequenceReference(node); }
if(queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext().getSequenceManager());
@SuppressWarnings("unchecked") @Override public QueryPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException { if(!getUdfParseNodes().isEmpty()) { stmt.throwIfUnallowedUserDefinedFunctions(getUdfParseNodes()); } SelectStatement select = SubselectRewriter.flatten(this, stmt.getConnection()); ColumnResolver resolver = FromCompiler.getResolverForQuery(select, stmt.getConnection()); select = StatementNormalizer.normalize(select, resolver); SelectStatement transformedSelect = SubqueryRewriter.transform(select, resolver, stmt.getConnection()); if (transformedSelect != select) { resolver = FromCompiler.getResolverForQuery(transformedSelect, stmt.getConnection()); select = StatementNormalizer.normalize(transformedSelect, resolver); } QueryPlan plan = new QueryCompiler(stmt, select, resolver, Collections.<PDatum>emptyList(), stmt.getConnection().getIteratorFactory(), new SequenceManager(stmt), true, false, null).compile(); plan.getContext().getSequenceManager().validateSequences(seqAction); return plan; }
if (queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext().getSequenceManager());
resultScanner = new OrderedAggregatingResultIterator(aggResultIterator, orderBy.getOrderByExpressions(), thresholdBytes, limit, offset); if (context.getSequenceManager().getSequenceCount() > 0) { resultScanner = new SequenceResultIterator(resultScanner, context.getSequenceManager());
targetColumns, parallelIteratorFactory, dataPlan.getContext().getSequenceManager(), true, true, dataPlans); return Collections.singletonList(compiler.compile());
for (JoinCompiler.Strategy strategy : strategies) { StatementContext newContext = new StatementContext( context.getStatement(), context.getResolver(), new Scan(), context.getSequenceManager()); QueryPlan plan = compileJoinQuery( strategy, newContext, binds, joinTable, asSubquery, projectPKColumns, orderBy);
if (context.getSequenceManager().getSequenceCount() > 0) { scanner = new SequenceResultIterator(scanner, context.getSequenceManager());
thresholdBytes, limit, offset); if (context.getSequenceManager().getSequenceCount() > 0) { resultScanner = new SequenceResultIterator(resultScanner, context.getSequenceManager());
@Override public MutationState execute() throws SQLException { ImmutableBytesWritable ptr = context.getTempPtr(); final SequenceManager sequenceManager = context.getSequenceManager();