concat method

LazyFrame concat(
  1. Iterable<LazyFrame> frames, {
  2. String how = 'vertical',
  3. bool rechunk = false,
})

Concatenates lazy frames owned by this runtime into one plan.

how is one of vertical, verticalRelaxed, diagonal, diagonalRelaxed, or horizontal. rechunk is not supported with horizontal concatenation. Throws an ArgumentError when frames is empty or an option is invalid.

Implementation

LazyFrame concat(
  Iterable<LazyFrame> frames, {
  String how = 'vertical',
  bool rechunk = false,
}) {
  final values = List<LazyFrame>.unmodifiable(frames);
  if (values.isEmpty) {
    throw ArgumentError.value(frames, 'frames', 'must not be empty');
  }
  const modes = {
    'vertical',
    'verticalRelaxed',
    'diagonal',
    'diagonalRelaxed',
    'horizontal',
  };
  if (!modes.contains(how)) {
    throw ArgumentError.value(how, 'how', 'unsupported concat mode');
  }
  if (how == 'horizontal' && rechunk) {
    throw ArgumentError.value(
      rechunk,
      'rechunk',
      'is not supported by horizontal concat',
    );
  }
  for (final frame in values) {
    _requireLazy(frame);
  }
  final leases = _leaseAll(values.map((value) => value._owner));
  try {
    return _adoptLazy(
      _client.invokeSync('lazyConcat', {
        'inputs': leases.map((lease) => lease.handle.toString()).toList(),
        'how': how,
        'rechunk': rechunk,
      }),
    );
  } finally {
    _releaseAll(leases);
  }
}