[ 
https://issues.apache.org/jira/browse/PHOENIX-1516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14284365#comment-14284365
 ] 

James Taylor commented on PHOENIX-1516:
---------------------------------------

Looked at the problem you're running into. It's happening because you've cloned 
the RowProjector, but the old/original RowProjector is the one that reset is 
being called on (since that's the one that's part of the iterator tree from the 
ScanPlan. The following tweak to UpsertingParallelIteratorFactory.mutate() in 
UpsertCompiler.java fixes the issue. I think the extra wrapping is not a big 
deal.
{code}
        @Override
        protected MutationState mutate(StatementContext context, ResultIterator 
iterator, PhoenixConnection connection) throws SQLException {
            PhoenixStatement statement = new PhoenixStatement(connection);
            if (context.getSequenceManager().getSequenceCount() > 0) {
                throw new IllegalStateException("Cannot pipeline upsert when 
sequence is referenced");
            }
            RowProjector clonedProjector = cloneRowProjector();
            ResultIterator resettingResultIterator = new 
ResettingResultIterator(iterator, clonedProjector);
            return upsertSelect(statement, tableRef, clonedProjector, 
resettingResultIterator, columnIndexes, pkSlotIndexes);
        }
{code}

> Add RANDOM built-in function
> ----------------------------
>
>                 Key: PHOENIX-1516
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1516
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Lars Hofhansl
>            Assignee: Lars Hofhansl
>         Attachments: 1516-v2.txt, 1516-v3.txt, 1516-v4-wip.txt, 
> 1516-v5-wip.txt, 1516.txt
>
>
> I often find it useful to generate some rows with random data.
> Here's a simple RANDOM() function that we could use for that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to