Collect the elements in an PRDD and concatenate the partition.
555953
def collect(self):
        """"""
        # The order of the frame order appends is based on the implementation
        # of reduce which calls our function with
        # f(valueToBeAdded, accumulator) so we do our reduce implementation.
        def append_frames(frame_a, frame_b):
            return frame_a.append(frame_b)
        return self._custom_rdd_reduce(append_frames)
767231
private void append(final byte[] next_qualifier, final byte[] next_value) {
    ensureCapacity(next_qualifier, next_value);

    // Now let's simply concatenate all the values together.
    System.arraycopy(next_value, 0, batched_value, value_index, next_value.length);
    value_index += next_value.length;

    // Now let's concatenate all the qualifiers together.
    System.arraycopy(next_qualifier, 0, batched_qualifier, qualifier_index, 
        next_qualifier.length);
    qualifier_index += next_qualifier.length;
  }
96880
private static List<Short> partitionsForVbids(int numPartitions, Short... vbids) {
    if (vbids.length > 0) {
      Arrays.sort(vbids);
      return Arrays.asList(vbids);
    }

    List<Short> partitions = new ArrayList<>(vbids.length);
    for (short i = 0; i < numPartitions; i++) {
      partitions.add(i);
    }
    return partitions;
  }
1211813
private <T> Collection<Integer> transformPartition(PartitionTransformation<T> partition) {
		StreamTransformation<T> input = partition.getInput();
		List<Integer> resultIds = new ArrayList<>();

		Collection<Integer> transformedIds = transform(input);
		for (Integer transformedId: transformedIds) {
			int virtualId = StreamTransformation.getNewNodeId();
			streamGraph.addVirtualPartitionNode(transformedId, virtualId, partition.getPartitioner());
			resultIds.add(virtualId);
		}

		return resultIds;
	}
778581
def combine_chunks(storage, args, prefix=None):
    '''
    
    '''
    uuid = args['uuid']
    # Normalize filename including extension
    target = utils.normalize(args['filename'])
    if prefix:
        target = os.path.join(prefix, target)
    with storage.open(target, 'wb') as out:
        for i in xrange(args['totalparts']):
            partname = chunk_filename(uuid, i)
            out.write(chunks.read(partname))
            chunks.delete(partname)
    chunks.delete(chunk_filename(uuid, META))
    return target
181053
def concatenate(cls, *args: List['ComponentRef']) -> 'ComponentRef':
        

        a = copy.deepcopy(args[0])
        n = a
        for b in args[1:]:
            while n.child:
                n = n.child[0]
            b = copy.deepcopy(b)  # Not strictly necessary
            n.child = [b]
        return a
1077290
def build_input_partitions(cls, name='inputTablePartitions', input_name='input'):
        
        obj = cls(name)
        obj.exporter = 'get_input_partitions'
        obj.input_name = input_name
        return obj
917606
def fetchable_partitions(self):
        """"""
        fetchable = set()
        for partition, state in six.iteritems(self.assignment):
            if state.is_fetchable():
                fetchable.add(partition)
        return fetchable
1137498
def merge(self, elements):
		'''  '''

		from collections import Counter
		from lltk.utils import list2tuple, tuple2list
		# The list2tuple conversion is necessary because mutable objects (e.g. lists) are not hashable
		merged = tuple2list([value for value, count in Counter(list2tuple(list(elements))).most_common()])
		return merged
1140425
def partition(self, predicate=None):
        
        predicate = self._lookupIterator(predicate)
        pass_list = []
        fail_list = []

        def by(elem, index, *args):
            (pass_list if predicate(elem) else fail_list).append(elem)

        _.each(self.obj, by)

        return self._wrap([pass_list, fail_list])
1165467
def _build_full_partition(
        optional_parts, sequence_var_partition: Sequence[int], subjects: Sequence[Expression], operation: Operation
) -> List[Sequence[Expression]]:
    
    i = 0
    var_index = 0
    opt_index = 0
    result = []
    for operand in op_iter(operation):
        wrap_associative = False
        if isinstance(operand, Wildcard):
            count = operand.min_count if operand.optional is None else 0
            if not operand.fixed_size or isinstance(operation, AssociativeOperation):
                count += sequence_var_partition[var_index]
                var_index += 1
                wrap_associative = operand.fixed_size and operand.min_count
            elif operand.optional is not None:
                count = optional_parts[opt_index]
                opt_index += 1
        else:
            count = 1

        operand_expressions = list(op_iter(subjects))[i:i + count]
        i += count

        if wrap_associative and len(operand_expressions) > wrap_associative:
            fixed = wrap_associative - 1
            operand_expressions = tuple(operand_expressions[:fixed]) + (
                create_operation_expression(operation, operand_expressions[fixed:]),
            )

        result.append(operand_expressions)

    return result
230824
def _concat(self, first_data, second_data):
        """"""
        assert len(first_data) == len(
            second_data), 'data source should contain the same size'
        if first_data and second_data:
            return [
                concat(
                    first_data[x],
                    second_data[x],
                    dim=0
                ) for x in range(len(first_data))
            ]
        elif (not first_data) and (not second_data):
            return []
        else:
            return [
                first_data[0] if first_data else second_data[0]
                for x in range(len(first_data))
            ]
19244
def append_partition(self, db_name, tbl_name, part_vals):
    
    self.send_append_partition(db_name, tbl_name, part_vals)
    return self.recv_append_partition()
430296
def partition(a:Collection, sz:int)->List[Collection]:
    ""
    return [a[i:i+sz] for i in range(0, len(a), sz)]
1010418
def Concat(self: Iterable, *others):
    
    return concat_generator(self, *[unbox_if_flow(other) for other in others])
295246
def split_all(reference, sep):
    
    parts = partition_all(reference, sep)
    return [p for p in parts if p not in sep]
1307898
def npartitions(self):
        
        if self.mode == 'spark':
            return self.tordd().getNumPartitions()
        else:
            notsupported(self.mode)