public interface RecordStream<K extends java.lang.Comparable<K>> extends java.util.stream.Stream<Record<K>>
Stream
of Record
instances.Modifier and Type | Method and Description |
---|---|
RecordStream<K> |
batch(int sizeHint)
Returns an equivalent stream that uses the given batch size hint.
|
RecordStream<K> |
distinct() |
RecordStream<K> |
explain(java.util.function.Consumer<java.lang.Object> consumer)
Observes the stream pipeline and provides the pre-execution analysis information for this stream pipeline.
|
RecordStream<K> |
filter(java.util.function.Predicate<? super Record<K>> predicate) |
RecordStream<K> |
inline()
Returns an equivalent stream where any client side operations are performed inline with the server side.
|
RecordStream<K> |
limit(long maxSize) |
static <T> java.util.function.Consumer<T> |
log(java.lang.String message,
java.util.function.Function<? super T,?>... mappers) |
RecordStream<K> |
onClose(java.lang.Runnable closeHandler) |
RecordStream<K> |
parallel() |
RecordStream<K> |
peek(java.util.function.Consumer<? super Record<K>> action) |
RecordStream<K> |
sequential() |
RecordStream<K> |
skip(long n) |
RecordStream<K> |
sorted()
|
RecordStream<K> |
sorted(java.util.Comparator<? super Record<K>> comparator)
Returns a
RecordStream<K> consisting of the elements of this stream, sorted
according to the provided Comparator . |
RecordStream<K> |
unordered() |
allMatch, anyMatch, builder, collect, collect, concat, count, empty, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, generate, iterate, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, of, of, reduce, reduce, reduce, toArray, toArray
RecordStream<K> explain(java.util.function.Consumer<java.lang.Object> consumer)
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.
consumer
- Consumer
that is passed an explanation of the stream execution planRecordStream<K>
RecordStream<K> batch(int sizeHint)
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.
RecordStream<K>
RecordStream<K> inline()
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.
RecordStream<K>
batch(int)
RecordStream<K> filter(java.util.function.Predicate<? super Record<K>> predicate)
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.
RecordStream<K> sorted()
sorted
in interface java.util.stream.Stream<Record<K extends java.lang.Comparable<K>>>
RecordStream<K>
sorted(Comparator)
RecordStream<K> sorted(java.util.Comparator<? super Record<K>> comparator)
RecordStream<K>
consisting of the elements of this stream, sorted
according to the provided Comparator
.
Following are the ways to get a RecordStream<K>
with records
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());
RecordStream<K> peek(java.util.function.Consumer<? super Record<K>> action)
RecordStream<K> limit(long maxSize)
RecordStream<K> skip(long n)
RecordStream<K> sequential()
RecordStream<K> parallel()
RecordStream<K> unordered()
RecordStream<K> onClose(java.lang.Runnable closeHandler)
@SafeVarargs static <T> java.util.function.Consumer<T> log(java.lang.String message, java.util.function.Function<? super T,?>... mappers)