[
https://issues.apache.org/jira/browse/PHOENIX-3477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15726485#comment-15726485
]
ASF GitHub Bot commented on PHOENIX-3477:
-----------------------------------------
Github user maryannxue commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/224#discussion_r91155610
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixClientProject.java
---
@@ -73,13 +70,10 @@ public QueryPlan implement(PhoenixRelImplementor
implementor) {
QueryPlan plan = implementor.visitInput(0, (PhoenixQueryRel)
getInput());
implementor.popContext();
-
- PhoenixSequence sequence = CalciteUtils.findSequence(this);
- final SequenceManager seqManager = sequence == null ?
- null : new SequenceManager(new
PhoenixStatement(sequence.pc));
- implementor.setSequenceManager(seqManager);
- TupleProjector tupleProjector = project(implementor);
- if (seqManager != null) {
+
--- End diff --
This entire wrapping logic should live in PhoenixToEnumerableConverter
instead. Wrapping it with an iterator not a query plan would be better,
something like:
{code}
return new DelegateQueryPlan((QueryPlan) plan) {
@Override
public ResultIterator iterator() throws SQLException {
ResultIterator iterator =
iterator(DefaultParallelScanGrouper.getInstance());
if
(phoenixImplementor.getSequenceManager().getSequenceCount() > 0) {
iterator = new SequenceResultIterator(iterator,
phoenixImplementor.getSequenceManager());
}
return iterator;
}
@Override
public ExplainPlan getExplainPlan() throws SQLException {
{code}
> Support sequence arithmetic in Calcite-Phoenix
> ----------------------------------------------
>
> Key: PHOENIX-3477
> URL: https://issues.apache.org/jira/browse/PHOENIX-3477
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: Eric Lomore
> Assignee: Eric Lomore
>
> When a sequence is wrapped inside an arithmetic operator it is routed through
> PhoenixServerProject which does not currently have sequence support
> {{SELECT NEXT VALUE FOR foo.bar+1 FROM SYSTEM.SEQUENCE.}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)