Interface RecordStream<K extends Comparable<K>>
- All Superinterfaces:
AutoCloseable
,BaseStream<Record<K>,
,Stream<Record<K>>> Stream<Record<K>>
- All Known Subinterfaces:
MutableRecordStream<K>
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.stream.Stream
Stream.Builder<T extends Object>
-
Method Summary
Modifier and TypeMethodDescriptionbatch
(int sizeHint) Returns an equivalent stream that uses the given batch size hint.distinct()
Observes the stream pipeline and provides the pre-execution analysis information for this stream pipeline.inline()
Returns an equivalent stream where any client side operations are performed inline with the server side.limit
(long maxSize) static <T> Consumer<T>
parallel()
skip
(long n) sorted()
sorted
(Comparator<? super Record<K>> comparator) Returns aRecordStream<K>
consisting of the elements of this stream, sorted according to the providedComparator
.Methods inherited from interface java.util.stream.BaseStream
close, isParallel, iterator, spliterator
Methods inherited from interface java.util.stream.Stream
allMatch, anyMatch, collect, collect, count, dropWhile, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, map, mapMulti, mapMultiToDouble, mapMultiToInt, mapMultiToLong, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, reduce, reduce, reduce, takeWhile, toArray, toArray, toList
-
Method Details
-
explain
Observes the stream pipeline and provides the pre-execution analysis information for this stream pipeline.A typical sample usage is given below.
try (RecordStream<String> testStream = dataset.records()) { long count = testStream.explain(System.out::println).filter(...).count(); }
Implementations may not call the consumer until after the stream has closed. Care must therefore be taken to avoid deadlocking stream processing by blocking the stream on waiting for the consumer to be called.
- Parameters:
consumer
-Consumer
that is passed an explanation of the stream execution plan- Returns:
- this
RecordStream<K>
-
batch
Returns an equivalent stream that uses the given batch size hint.Stream executions will attempt (when possible) to optimize execution by transferring multiple elements over the network at one time. The size hint provided here will be used as a hint to the batch sizes to use when transferring elements.
- Returns:
- this
RecordStream<K>
-
inline
RecordStream<K> inline()Returns an equivalent stream where any client side operations are performed inline with the server side.Inline execution runs the client side portion of a pipeline synchronously during the server side processing. This means that until the client side portion of the stream pipeline has finished executing the server stream will not advance to process the next element.
Unlike
batch(int)
this operation is an edict and not a hint. This means marking a stream as inline overrides any previous or future batching instruction.- Returns:
- this
RecordStream<K>
- See Also:
-
filter
- Specified by:
filter
in interfaceStream<K extends Comparable<K>>
-
distinct
RecordStream<K> distinct()Record streams are distinct by definition since they represent the records found within a dataset. Implementations may therefore choose to elide distinct operations from the pipeline.
- Specified by:
distinct
in interfaceStream<K extends Comparable<K>>
- Returns:
- a distinct stream (possibly the same stream)
-
sorted
RecordStream<K> sorted()- Specified by:
sorted
in interfaceStream<K extends Comparable<K>>
- Returns:
- a new
RecordStream<K>
- See Also:
-
sorted
Returns aRecordStream<K>
consisting of the elements of this stream, sorted according to the providedComparator
.Following are the ways to get a
RecordStream<K>
withrecords
sorted by the key or sorted by the value of a cell.RecordStream<String> keySortedRecordStream = recordStream.sorted(Record.<K>keyFunction().asComparator()); RecordStream<String> cellSortedRecordStream = recordStream.sorted(NAME.valueOr("").asComparator());
- Specified by:
sorted
in interfaceStream<K extends Comparable<K>>
- Parameters:
comparator
- used to compareRecord
s in the stream- Returns:
- a new
RecordStream<K>
-
peek
- Specified by:
peek
in interfaceStream<K extends Comparable<K>>
-
limit
- Specified by:
limit
in interfaceStream<K extends Comparable<K>>
-
skip
- Specified by:
skip
in interfaceStream<K extends Comparable<K>>
-
sequential
RecordStream<K> sequential()- Specified by:
sequential
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>>
-
parallel
RecordStream<K> parallel()- Specified by:
parallel
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>>
-
unordered
RecordStream<K> unordered()- Specified by:
unordered
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>>
-
onClose
- Specified by:
onClose
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>>
-
log
-