You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Vaclav Loffelmann (JIRA)" <ji...@apache.org> on 2014/10/28 20:55:34 UTC

[jira] [Comment Edited] (PHOENIX-1343) Array insert unique function

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

Vaclav Loffelmann edited comment on PHOENIX-1343 at 10/28/14 7:54 PM:
----------------------------------------------------------------------

Our use-case is to add some values and append few of items to big array hence we want to do our best to avoid transport all data to client.
How this can be done with transactions? I can't imagine how it could be done. [~jamestaylor] Do you mean something like this?
{code}
BEGIN;
UPSERT INTO table (
    SELECT ARRAY_MERGE_UNIQUE(my_array, ARRAY["new element"]) FROM table WHERE id = 3
);
UPSERT INTO table (val1, val2) VALUES (1, 2);
COMMIT;
{code}

Or transactions can be done on background with UPDATE query, but there is still requirement to do it at region server coprocessor.




was (Author: tzolkin):
Our use-case is to add some values and append few of items to big array hence we want to do our best to avoid transport all data to client.
How this can be done with transactions? I can't imagine how it could be done. Do you mean something like this?
{code}
BEGIN;
UPSERT INTO table (
    SELECT ARRAY_MERGE_UNIQUE(my_array, ARRAY["new element"]) FROM table WHERE id = 3
);
UPSERT INTO table (val1, val2) VALUES (1, 2);
COMMIT;
{code}

Or transactions can be done on background with UPDATE query, but there is still requirement to do it at region server coprocessor.



> Array insert unique function
> ----------------------------
>
>                 Key: PHOENIX-1343
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1343
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Vaclav Loffelmann
>            Assignee: Vaclav Loffelmann
>            Priority: Minor
>
> I'm working on function for insert unique values to an array. Logic should be implemented on region server coprocessor (for enforcing consistency and no network round trip). First step is to get current values of the array, merge with upsert values and write as new value.



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