public interface MutableRecordStream<K extends java.lang.Comparable<K>> extends RecordStream<K>
Modifier and Type | Method and Description |
---|---|
MutableRecordStream<K> |
batch(int sizeHint)
Returns an equivalent stream that uses the given batch size hint.
|
void |
delete()
Deletes every
Record in the stream. |
java.util.stream.Stream<Record<K>> |
deleteThen()
Deletes every
Record in the stream. |
MutableRecordStream<K> |
distinct() |
MutableRecordStream<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.
|
MutableRecordStream<K> |
filter(java.util.function.Predicate<? super Record<K>> predicate) |
MutableRecordStream<K> |
inline()
Returns an equivalent stream where any client side operations are performed inline with the server side.
|
MutableRecordStream<K> |
limit(long maxSize) |
void |
mutate(UpdateOperation<? super K> transform)
Performs an update transformation against the
Record s in the stream. |
java.util.stream.Stream<Tuple<Record<K>,Record<K>>> |
mutateThen(UpdateOperation<? super K> transform)
Performs an update transformation against the
Record s in the stream. |
MutableRecordStream<K> |
onClose(java.lang.Runnable closeHandler) |
MutableRecordStream<K> |
parallel() |
MutableRecordStream<K> |
peek(java.util.function.Consumer<? super Record<K>> action) |
MutableRecordStream<K> |
sequential() |
MutableRecordStream<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 . |
MutableRecordStream<K> |
unordered() |
log
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
void mutate(UpdateOperation<? super K> transform)
Record
s in the stream.
This is a terminal operation.
transform
- the transformation to performjava.util.stream.Stream<Tuple<Record<K>,Record<K>>> mutateThen(UpdateOperation<? super K> transform)
Record
s in the stream.
This is an intermediate operation.
transform
- the transformation to performStream
of new Tuple
s holding before and after Record
instancesvoid delete()
Record
in the stream.
This is a terminal operation.
java.util.stream.Stream<Record<K>> deleteThen()
Record
in the stream.
This is an intermediate operation.
Stream
of the deleted Record
sMutableRecordStream<K> filter(java.util.function.Predicate<? super Record<K>> predicate)
MutableRecordStream<K> distinct()
RecordStream
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()
java.lang.UnsupportedOperationException
since records
are not Comparable
.
Sorting a MutableRecordStream
returns a non-mutable RecordStream
.
sorted
in interface RecordStream<K extends java.lang.Comparable<K>>
sorted
in interface java.util.stream.Stream<Record<K extends java.lang.Comparable<K>>>
RecordStream
RecordStream.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());
Sorting a MutableRecordStream
returns a non-mutable RecordStream
.
MutableRecordStream<K> peek(java.util.function.Consumer<? super Record<K>> action)
MutableRecordStream<K> limit(long maxSize)
MutableRecordStream<K> skip(long n)
MutableRecordStream<K> sequential()
sequential
in interface java.util.stream.BaseStream<Record<K extends java.lang.Comparable<K>>,java.util.stream.Stream<Record<K extends java.lang.Comparable<K>>>>
sequential
in interface RecordStream<K extends java.lang.Comparable<K>>
MutableRecordStream<K> parallel()
MutableRecordStream<K> unordered()
MutableRecordStream<K> onClose(java.lang.Runnable closeHandler)
MutableRecordStream<K> explain(java.util.function.Consumer<java.lang.Object> consumer)
RecordStream
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.
explain
in interface RecordStream<K extends java.lang.Comparable<K>>
consumer
- Consumer
that is passed an explanation of the stream execution planRecordStream<K>
MutableRecordStream<K> batch(int sizeHint)
RecordStream
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.
batch
in interface RecordStream<K extends java.lang.Comparable<K>>
RecordStream<K>
MutableRecordStream<K> inline()
RecordStream
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 RecordStream.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.
inline
in interface RecordStream<K extends java.lang.Comparable<K>>
RecordStream<K>
RecordStream.batch(int)