You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by morokosi <gi...@git.apache.org> on 2017/08/28 14:29:50 UTC

[GitHub] storm pull request #2295: STORM-2712: accept arbitrary number of rows per tu...

GitHub user morokosi opened a pull request:

    https://github.com/apache/storm/pull/2295

    STORM-2712: accept arbitrary number of rows per tuple in storm-cassandra

    Current implementation in `TridentResultSetValuesMapper::map` restricts a SELECT query to return one row. In `StateQueryProcessor::finishBatch`, it checks the equality between the result size of `batchRetrieve` and input tuple size. When the number of result rows is less than 1 or greater than 1, it breaks the condition and an exception is thrown.
    
    We should accept arbitrary number of rows by adjusting List dimensions.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/morokosi/storm cassandra-resultset-mapper

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/2295.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2295
    
----
commit 58bd51ec88c8eff02d35904e106edd68ea45e6a4
Author: morokosi <mo...@gmail.com>
Date:   2017-08-28T13:59:14Z

    STORM-2712: accept arbitrary number of rows per tuple in storm-cassandra

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm issue #2295: STORM-2712: accept arbitrary number of rows per tuple in ...

Posted by morokosi <gi...@git.apache.org>.
Github user morokosi commented on the issue:

    https://github.com/apache/storm/pull/2295
  
    In a nutshell, the changeset makes utilize of inner list dimensions correctly when a cassandra query result has multiple rows.
    
    Assume we have a cassandra table like the following:
    
    ```sql
    CREATE TABLE t1 (pk int, ck int, data text, PRIMARY KEY (pk, ck)));
    ```
    
    | pk | ck | data |
    | -- | -- | -- |
    | 1 | 0 | a |
    | 1 | 1 | b |
    | 2 | 0 | c |
    | 3 | 0 | d |
    
    and we have a StateQuery as `SELECT data from t1 where pk = ?` with input tuples `1,2,3`.
    
    With current implementation, the return list of `TridentResultSetValuesMapper::map` is as follows:
    
    ```
    [
      [values(pk=1, ck=0)],
      [values(pk=1, ck=1)],
      [values(pk=2, ck=0)],
      [values(pk=3, ck=0)]
    ]
    ```
    
    This throws an exception because the list size differs from the input tuple size.
    
    On the other hand, one with the changeset results
    
    ```
    [
      [values(pk=1, ck=0), values(pk=1, ck=1)],
      [values(pk=2, ck=0)],
      [values(pk=3, ck=0)]  
    ]
    ```
    
    which the list size is same as the input tuple size.


---

[GitHub] storm pull request #2295: STORM-2712: accept arbitrary number of rows per tu...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2295#discussion_r139648054
  
    --- Diff: external/storm-cassandra/src/main/java/org/apache/storm/cassandra/trident/state/TridentResultSetValuesMapper.java ---
    @@ -44,6 +44,8 @@ public TridentResultSetValuesMapper(Fields outputDeclaredFields) {
         @Override
         public List<List<Values>> map(Session session, Statement statement, ITuple tuple) {
             List<List<Values>> list = new ArrayList<>();
    +        List<Values> innerList = new LinkedList<>();
    --- End diff --
    
    Could you explain that how different the changeset is? I don't get it and for me it looks like same.


---

[GitHub] storm pull request #2295: STORM-2712: accept arbitrary number of rows per tu...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/storm/pull/2295


---

[GitHub] storm issue #2295: STORM-2712: accept arbitrary number of rows per tuple in ...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the issue:

    https://github.com/apache/storm/pull/2295
  
    Could you explain that how different the changeset is? I don't get it and for me it looks like same.


---

[GitHub] storm issue #2295: STORM-2712: accept arbitrary number of rows per tuple in ...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the issue:

    https://github.com/apache/storm/pull/2295
  
    Ah OK. I missed that difference while looking at the code, and now I realized the difference even in the code.
    Thanks for clarifying. +1


---