Interface RecordStream<K extends Comparable<K>>

All Superinterfaces:
AutoCloseable, BaseStream<Record<K>,Stream<Record<K>>>, Stream<Record<K>>
All Known Subinterfaces:
MutableRecordStream<K>

public interface RecordStream<K extends Comparable<K>> extends Stream<Record<K>>
A Stream of Record instances.
  • Method Details

    • explain

      RecordStream<K> explain(Consumer<Object> consumer)
      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

      RecordStream<K> batch(int sizeHint)
      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

      RecordStream<K> filter(Predicate<? super Record<K>> predicate)
      Specified by:
      filter in interface Stream<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 interface Stream<K extends Comparable<K>>
      Returns:
      a distinct stream (possibly the same stream)
    • sorted

      RecordStream<K> sorted()
      This method will throw a java.lang.UnsupportedOperationException since records are not Comparable.
      Specified by:
      sorted in interface Stream<K extends Comparable<K>>
      Returns:
      a new RecordStream<K>
      See Also:
    • sorted

      RecordStream<K> sorted(Comparator<? super Record<K>> comparator)
      Returns a 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());
       

      Specified by:
      sorted in interface Stream<K extends Comparable<K>>
      Parameters:
      comparator - used to compare Records in the stream
      Returns:
      a new RecordStream<K>
    • peek

      RecordStream<K> peek(Consumer<? super Record<K>> action)
      Specified by:
      peek in interface Stream<K extends Comparable<K>>
    • limit

      RecordStream<K> limit(long maxSize)
      Specified by:
      limit in interface Stream<K extends Comparable<K>>
    • skip

      RecordStream<K> skip(long n)
      Specified by:
      skip in interface Stream<K extends Comparable<K>>
    • sequential

      RecordStream<K> sequential()
      Specified by:
      sequential in interface BaseStream<Record<K extends Comparable<K>>,Stream<Record<K extends Comparable<K>>>>
    • parallel

      RecordStream<K> parallel()
      Specified by:
      parallel in interface BaseStream<Record<K extends Comparable<K>>,Stream<Record<K extends Comparable<K>>>>
    • unordered

      RecordStream<K> unordered()
      Specified by:
      unordered in interface BaseStream<Record<K extends Comparable<K>>,Stream<Record<K extends Comparable<K>>>>
    • onClose

      RecordStream<K> onClose(Runnable closeHandler)
      Specified by:
      onClose in interface BaseStream<Record<K extends Comparable<K>>,Stream<Record<K extends Comparable<K>>>>
    • log

      @SafeVarargs static <T> Consumer<T> log(String message, Function<? super T,?>... mappers)