Nathan Schile created CRUNCH-607:
------------------------------------

             Summary: MemGroupedTable - iterator() can only be called once on 
this Iterable
                 Key: CRUNCH-607
                 URL: https://issues.apache.org/jira/browse/CRUNCH-607
             Project: Crunch
          Issue Type: Bug
          Components: Core
    Affects Versions: 0.8.4
            Reporter: Nathan Schile
            Assignee: Josh Wills


>From the user mailing list:

I'm running into a "java.lang.IllegalStateException: iterator() can only be 
called once on this Iterable" [1] when running a unit test that 
utilizes a MemCollection. The pipeline appears to runs fine when running on a 
cluster. I have a PGroupedTable that I am running multiple operations 
(mapValues, ungroup) [2] on that is causing the exception. The mapValues and 
the ungroup operations are run in separate jobs on the cluster, so I don't 
believe I should be running into iterator issues. This constraint was 
introduced by CRUNCH-192 [3]. 

Gabriel Reid stated "Looks like the MemPipeline is doing something wrong when 
multiple PCollections are created from a single PCollection." [4]

[1]
apache-crunch-0.8.4 branch

iterator() can only be called once on this Iterable
java.lang.IllegalStateException: iterator() can only be called once on this 
Iterable
        at 
org.apache.crunch.impl.SingleUseIterable.iterator(SingleUseIterable.java:43)
        at 
org.apache.crunch.impl.mem.collect.MemGroupedTable$UngroupFn.process(MemGroupedTable.java:148)
        at 
org.apache.crunch.impl.mem.collect.MemGroupedTable$UngroupFn.process(MemGroupedTable.java:145)
        at 
org.apache.crunch.impl.mem.collect.MemCollection.parallelDo(MemCollection.java:155)
        at 
org.apache.crunch.impl.mem.collect.MemCollection.parallelDo(MemCollection.java:143)
        at 
org.apache.crunch.impl.mem.collect.MemGroupedTable.ungroup(MemGroupedTable.java:142)

[2]
PGroupedTable<String, Item> itemsByPersonId =
        AvroCollections.keyByAvroField(items, "person_id", 
Avros.strings()).groupByKey();

PTable<String, Long> newestOrderByPersonId =
        itemsByPersonId
            .mapValues("Find latest order for each person", new 
MaxOrderMapFn(), Avros.longs());

return itemsByPersonId.ungroup().join(newestOrderByPersonId).parallelDo(
        "Filter old items, leaving only current order items",
        new PreviousOrderItemFilter(),
        Avros.tableOf(Avros.strings(), Avros.specifics(Item.class)));

[3] https://issues.apache.org/jira/browse/CRUNCH-192
https://github.com/apache/crunch/commit/cbc7c2fb30ad0486e7ec60656c079c81e41eda2c
[4] http://mail-archives.apache.org/mod_mbox/crunch-user/201604.mbox/date



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

Reply via email to