You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by desmorto <gi...@git.apache.org> on 2017/10/06 06:44:18 UTC

[GitHub] cassandra pull request #161: (refactor) some opportunities to use lambda fun...

GitHub user desmorto opened a pull request:

    https://github.com/apache/cassandra/pull/161

    (refactor) some opportunities to use lambda functions

    

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

    $ git pull https://github.com/desmorto/cassandra refactor-lambda

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

    https://github.com/apache/cassandra/pull/161.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 #161
    
----
commit 97a8969b06341ca6edc6c9c3f700fcf0ab354b47
Author: desmorto <re...@gmail.com>
Date:   2017-10-06T06:42:34Z

    (refactor) some opportunities to use lambda functions

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] cassandra pull request #161: (refactor) some opportunities to use lambda fun...

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

    https://github.com/apache/cassandra/pull/161#discussion_r143227588
  
    --- Diff: src/java/org/apache/cassandra/auth/CassandraRoleManager.java ---
    @@ -448,10 +449,6 @@ private void removeAllMembers(String role) throws RequestValidationException, Re
                     consistencyForRole(role));
         }
     
    -    /*
    -     * Convert a map of Options from a CREATE/ALTER statement into
    -     * assignment clauses used to construct a CQL UPDATE statement
    -     */
    --- End diff --
    
    why delete this comment?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] cassandra pull request #161: (refactor) some opportunities to use lambda fun...

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

    https://github.com/apache/cassandra/pull/161#discussion_r143230080
  
    --- Diff: src/java/org/apache/cassandra/cql3/CQL3Type.java ---
    @@ -826,13 +827,18 @@ public CQL3Type prepare(String keyspace, Types udts) throws InvalidRequestExcept
                         freeze();
     
                     List<AbstractType<?>> ts = new ArrayList<>(types.size());
    -                for (CQL3Type.Raw t : types)
    -                {
    -                    if (t.isCounter())
    -                        throw new InvalidRequestException("Counters are not allowed inside tuples");
    -
    -                    ts.add(t.prepare(keyspace, udts).getType());
    -                }
    +                types.stream()
    +                        .map(
    +                                t -> {
    +                                    if (t.isCounter())
    +                                        throw new InvalidRequestException(
    +                                                "Counters are not allowed inside tuples");
    +                                    return t;
    +                                })
    +                        .forEach(
    +                                t -> {
    +                                    ts.add(t.prepare(keyspace, udts).getType());
    +                                });
    --- End diff --
    
    This looks worse, and if your going to convert to a new list you can just do the mapping like
    
    ```
    types.stream().map(t ->
    {
        if (t.isCounter())
            throw new InvalidRequestException("Counters are not allowed inside tuples");
        return t.prepare(keyspace, udts).getType()
    }
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] cassandra issue #161: (refactor) some opportunities to use lambda functions

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

    https://github.com/apache/cassandra/pull/161
  
    Please see my comment to you in #155  - this type of refactor is rarely desirable, and needs to go through JIRA. We have docs on how to contribute, and opening this type of pull request is not generally useful. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org