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
3
votes
5 answers

Question on Ruby collect method

I have an array of hashes Eg: cars = [{:company => "Ford", :type => "SUV"}, {:company => "Honda", :type => "Sedan"}, {:company => "Toyota", :type => "Sedan"}] # i want to fetch all the companies of the cars cars.collect{|c|…
Punit Rathore
  • 970
  • 1
  • 8
  • 16
3
votes
3 answers

Formatting a 2d int array into a string using streams

I have the following array: private static final int[][] BOARD = { { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } }; And I want to create a String representation on it, so if I were…
alejo
  • 317
  • 3
  • 10
3
votes
1 answer

Collect to treemap java 8

I wanted to collect the result to a TreeMap by processing a TreeMap>. TreeMap result2 = units.entrySet().stream() .filter(v -> v.getValue().size()>3) …
3
votes
2 answers

Use jq to collect recursive-descent results into a single array

Is it possible to collect recursive-descent results into a single array with jq? Would flatten help? Looks so to me, but I just cannot get it working. Take a look how far I am now at https://jqplay.org/s/6bxD-Wq0QE, anyone can make it working?…
xpt
  • 20,363
  • 37
  • 127
  • 216
3
votes
2 answers

Filtering a scala string sequence based on a list of strings

I have a Scala sequence which is of format ("Apple-fruit", "Banana-fruittoo", "Chocolate-notafruit") and I have another Scala list of format ("Apple", "Banana") I want to filter my first sequence based on second list so that my final output is…
user461112
  • 3,811
  • 3
  • 20
  • 25
3
votes
2 answers

Reverse of grouping in java 8

I can group the list of students using the below lamda expression. The result would be grouping the student list grouped by "Department" and then grouped by "gender". Map>> studentCatg =…
june
  • 101
  • 2
  • 10
3
votes
1 answer

Hive - Create map columns type by aggregating values across groups

I have a table that looks like this: |customer|category|room|date| ----------------------------- |1 | A | aa | d1 | |1 | A | bb | d2 | |1 | B | cc | d3 | |1 | C | aa | d1 | |1 | C | bb | d2 | |2…
Lou_Ds
  • 531
  • 2
  • 11
  • 23
3
votes
0 answers

Clojure error- GC overhead limit exceeded using reducer with lazy sequence

; Test 1 - Using Map Reduce (Successful) (ns example (:gen-class)) (require '[clojure.core.reducers :as r]) (def n 100000000000) (time (println "map: " (reduce + 0N (map inc (range n))))) I get: map: 5000000000050000000000N "Elapsed time:…
DarrylG
  • 16,732
  • 2
  • 17
  • 23
3
votes
1 answer

collect attributes and values into string list

I have xml data looking like this: John Doe Jane Doe I want to collect them into a list of maps like [[key: M, name: John Doe], [key: N, name: Jane Doe]] and I use, after…
serafim
  • 75
  • 1
  • 1
  • 9
3
votes
1 answer

Neo4j cypher query : using ORDER BY with COLLECT(S)

I'm having a hard time collecting data from two distinct sources and merge the collections so that the final one is a set of objects ordered by 'dateCreated'. Context Users can ask questions in groups. A question can be either general or related to…
Brice
  • 1,026
  • 9
  • 20
3
votes
0 answers

Failed to collect preference classes

I am new to writing Android applications, so new that my knowledge of Eclipse is so basic it hurts. I want to know why when I start a new Android project (using only default settings) I immediately get an these errors? Error Fri Apr 12 00:08:30 EDT…
GabrielC37
  • 31
  • 3
3
votes
2 answers

Splitting an array at random in Scala

I'm building a decision tree system in Scala, but some of the entries in my data have identical attributes. I've gotten around this by implementing a "random" node type, allowing the query to randomly select which branch to traverse, but I'm…
Tin Wizard
  • 242
  • 2
  • 16
3
votes
1 answer

Collecting usage data about internet

Where do sources such as alexa, compete, etc collect their data from to build internet statistics such as the top websites and websites' most visited from countries list?
Vish
  • 4,508
  • 10
  • 42
  • 74
2
votes
0 answers

Does spark's collect() action, after an orderBy, provide the order preserved list?

I have a dataframe in spark scala, when I perform a collect operation on the dataframe after an orderBy operation, will the order be preserved in the collected scala list? val schema = StructType(Array( …
Yogesh Patel
  • 41
  • 1
  • 10
2
votes
0 answers

Is it safe to use df.select(column_name).rdd.flatMap(lambda x: x).collect() when the order is important?

As part of investigation I came to this link: flatMap doesn't preserve order when creating lists from pyspark dataframe columns which would suggest that it is not safe. However, these links state that flatMap() preserves order: Does flatMap keep the…
MichiganMagician
  • 273
  • 2
  • 15