Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Significant reworking of RecordReaderGenericBase for #144; when colle…
…cting the split's flow to lists all tests succeed; otherwise there is a 'MissingBackPressure' exception. Maybe still a bug in FlowableOperatorSequentialGroupBy?
- Loading branch information
Showing
9 changed files
with
278 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
sansa-hadoop-jena/src/main/java/net/sansa_stack/hadoop/generic/Accumulating.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.sansa_stack.hadoop.generic; | ||
|
||
import org.aksw.jena_sparql_api.mapper.Acc; | ||
|
||
public interface Accumulating<T, G, A, U> { | ||
G classify(T item); | ||
A createAccumulator(G groupKey); | ||
void accumulate(A accumulator, T item); | ||
U accumulatedValue(A accumulator); | ||
|
||
|
||
/** | ||
* Identity accumulator - turns each item into a group that contains only the item and whose value is the item | ||
* | ||
* @param <T> | ||
* @return | ||
*/ | ||
static <T> Accumulating identity() { | ||
return new Accumulating<T, T, T, T>() { | ||
@Override | ||
public T classify(T item) { | ||
return item; | ||
} | ||
|
||
@Override | ||
public T createAccumulator(T groupKey) { | ||
return groupKey; | ||
} | ||
|
||
@Override | ||
public void accumulate(T accumulator, T item) { | ||
/* nothing to do */ | ||
} | ||
|
||
@Override | ||
public T accumulatedValue(T accumulator) { | ||
return accumulator; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.