Interface MutableRecordStream<K extends Comparable<K>>
- All Superinterfaces:
AutoCloseable
,BaseStream<Record<K>,
,Stream<Record<K>>> RecordStream<K>
,Stream<Record<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.void
delete()
Deletes everyRecord
in the stream.Deletes everyRecord
in the stream.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) void
mutate
(UpdateOperation<? super K> transform) Performs an update transformation against theRecord
s in the stream.mutateThen
(UpdateOperation<? super K> transform) Performs an update transformation against theRecord
s in the stream.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
-
mutate
Performs an update transformation against theRecord
s in the stream.This is a terminal operation.
- Parameters:
transform
- the transformation to perform
-
mutateThen
Performs an update transformation against theRecord
s in the stream.This is an intermediate operation.
- Parameters:
transform
- the transformation to perform- Returns:
- a
Stream
of newTuple
s holding before and afterRecord
instances
-
delete
void delete()Deletes everyRecord
in the stream.This is a terminal operation.
-
deleteThen
Deletes everyRecord
in the stream.This is an intermediate operation.
- Returns:
- a
Stream
of the deletedRecord
s
-
filter
- Specified by:
filter
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
filter
in interfaceStream<K extends Comparable<K>>
-
distinct
MutableRecordStream<K> distinct()Description copied from interface: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.
- Specified by:
distinct
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
distinct
in interfaceStream<K extends Comparable<K>>
- Returns:
- a distinct stream (possibly the same stream)
-
sorted
RecordStream<K> sorted()This method will throw ajava.lang.UnsupportedOperationException
sincerecords
are notComparable
.Sorting a
MutableRecordStream
returns a non-mutableRecordStream
.- Specified by:
sorted
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
sorted
in interfaceStream<K extends Comparable<K>>
- Returns:
- a new, non-mutable
RecordStream
- 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());
Sorting a
MutableRecordStream
returns a non-mutableRecordStream
.- Specified by:
sorted
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
sorted
in interfaceStream<K extends Comparable<K>>
- Parameters:
comparator
- used to compareRecord
s in the stream- Returns:
- a new, non-mutable
RecordStream
-
peek
- Specified by:
peek
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
peek
in interfaceStream<K extends Comparable<K>>
-
limit
- Specified by:
limit
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
limit
in interfaceStream<K extends Comparable<K>>
-
skip
- Specified by:
skip
in interfaceRecordStream<K extends Comparable<K>>
- Specified by:
skip
in interfaceStream<K extends Comparable<K>>
-
sequential
MutableRecordStream<K> sequential()- Specified by:
sequential
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>> - Specified by:
sequential
in interfaceRecordStream<K extends Comparable<K>>
-
parallel
MutableRecordStream<K> parallel()- Specified by:
parallel
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>> - Specified by:
parallel
in interfaceRecordStream<K extends Comparable<K>>
-
unordered
MutableRecordStream<K> unordered()- Specified by:
unordered
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>> - Specified by:
unordered
in interfaceRecordStream<K extends Comparable<K>>
-
onClose
- Specified by:
onClose
in interfaceBaseStream<Record<K extends Comparable<K>>,
Stream<Record<K extends Comparable<K>>>> - Specified by:
onClose
in interfaceRecordStream<K extends Comparable<K>>
-
explain
Description copied from interface:RecordStream
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.
- Specified by:
explain
in interfaceRecordStream<K extends Comparable<K>>
- Parameters:
consumer
-Consumer
that is passed an explanation of the stream execution plan- Returns:
- this
RecordStream<K>
-
batch
Description copied from interface:RecordStream
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.
- Specified by:
batch
in interfaceRecordStream<K extends Comparable<K>>
- Returns:
- this
RecordStream<K>
-
inline
MutableRecordStream<K> inline()Description copied from interface:RecordStream
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
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.- Specified by:
inline
in interfaceRecordStream<K extends Comparable<K>>
- Returns:
- this
RecordStream<K>
- See Also:
-