Questions tagged [collect]

Use this tag for questions related to the act of gathering/collecting/grouping data/results from several nodes/places/computers to one (or main) resource(s).

Use this tag for questions related to the act of gathering/collecting/grouping data/results from several nodes/places/computers to one (or main) resource(s).

For example, in Distributed Computing, the slaves would do their local computation and eventually, one would like the master to collect the (local) results.

354 questions
4
votes
2 answers

Scala Option's collect method doesn't like my PartialFunction

I think I'm missing something: scala> Some(1) collect ({ case n if n > 0 => n + 1; case _ => 0}) res0: Option[Int] = Some(2) scala> None collect ({ case n if n > 0 => n + 1; case _ => 0}) :6: error: value > is not a member of Nothing …
pr1001
  • 21,727
  • 17
  • 79
  • 125
4
votes
1 answer

oracle sql: collect aggregation

I want to group my database entries by an attribute and to know which entries are in each group at the same time. I collect the ids of the grouped entries with Oracle COLLECT function COLLECT Function DECLARE TYPE ids_type IS TABLE OF number(19,…
Ewgenij Sokolovski
  • 897
  • 1
  • 12
  • 31
4
votes
2 answers

Perl class attribute composition?

Suppose I have multiple roles, each one defining a set of items: package A; use Moose::Role; sub items () { qw/apple orange/ } package B; use Moose::Role; with 'A'; sub items () { qw/watermelon/ } package C; use Moose::Role; sub items () {…
Alessandro
  • 1,336
  • 8
  • 15
4
votes
2 answers

numpy - return index If value inside one of 3d array

How to do this in Numpy : Thank you! Input : A = np.array([0, 1, 2, 3]) B = np.array([[3, 2, 0], [0, 2, 1], [2, 3, 1], [3, 0, 1]]) Output : result = [[0, 1, 3], [1, 2, 3], [0, 1, 2], [0, 2, 3]] in Python : A = np.array([0 ,1 ,2 ,3]) B =…
Helihallow
  • 57
  • 6
4
votes
2 answers

Java stream collect to map with multiple keys

I thought I was getting pretty good at Java 8 streams, but then... I have a Foo interface: public interface Foo { String getKey(); Stream bars(); } I know I can collect a Stream into a Map using the key of…
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
4
votes
2 answers

What is the best practice to collect a large data set from spark rdd?

I am using pyspark to process my data and at the very end i need collect data from rdd using rdd.collect(). However, my spark crashes due to the memory problem. I tried a number of ways, but no luck. I am now running with the following code, process…
JamesLi
  • 61
  • 1
  • 4
4
votes
4 answers

Java collect with lambda expression example

I was trying to convert this String r = ""; for ( Persona p : list ) { r += p.lastName; } To stream().filter.collect() form, but I want to know how to write the collect with a lambda expression (not method references). I couldn't find a…
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
4
votes
1 answer

Cypher COLLECT makes UNWIND unwind in wrong order

Graph gist: http://gist.neo4j.org/?6182d024325343760cb4 I want to get a (longest) path in order and it works as expected until I add a COLLECT statement, is there something concerning Cypher and COLLECT that I just don't understand or is this a…
Lundberg
  • 111
  • 7
4
votes
1 answer

collect2.exe: error: ld returned 1 exit status

Please I need help when I try to compile my .C to png gcc --std=c99 -Wall -lz a.c -o a.png c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lz collect2.exe: error: ld returned 1 exit status What does this mean?
user3695946
  • 49
  • 1
  • 1
  • 4
4
votes
2 answers

Rebol COLLECT: keep the order of the source data in a loop

There is some source data, like [1 2 3 4 "a" "b" "c" "d"], four items as a group. I want to extract some data at specific positions, such as the first, third, and fourth from each group. There is my code: data: [1 2 3 4 "a" "b" "c" "d"] output: copy…
Wayne Cui
  • 835
  • 7
  • 15
4
votes
3 answers

C++ collect algorithm?

Every now and then I need to iterate over a subset of the elements of a container or just want to extract them and neglect the rest. I end up using boost::range::adaptors::filtered to create this lazy collections. for(auto&& i : container |…
gnzlbg
  • 7,135
  • 5
  • 53
  • 106
3
votes
2 answers

Filter on the basis of multiple strings in a pyspark array column

df = sqlContext.createDataFrame(pd.DataFrame([('id1', ['a','b','c']), ('id2', ['a','b','d']), ('id3', ['c','e','f'])], …
3
votes
3 answers

Java 8 stream map custom function and convert it to Map

I have the following object: public class Book { private Long id; private Long bookId; private String bookName; private String owner; } Represented from following table: Basically, a book can be owned by multiple owners i.e. Owner…
Mihir
  • 531
  • 2
  • 10
  • 35
3
votes
1 answer

R - tbl/collect is slow sometimes

I use dplyr for getting data from sql database and it usually works pretty well. But sometimes my code runs very slow and I'm not sure why. Most of the time I connect to tables with 1 milion rows, I filter some data and then I use collect function…
user4394417
3
votes
2 answers

Groovy collect nested elements along with outer element

Using Groovy, requirement is to collect a map's nested element values, along with its top-level element value. Unsure if a recursive method is needed. Sample JSON { "items": [ { "attribute": "Type", "options": [ …
NScara
  • 55
  • 6