@staticmethod
def _prepare_for_group_by(record_store_with_group_by_rdd):
    """Creates a new rdd where:

        The first element of each row contains array of grouping
        key and event timestamp fields.

        Grouping key and event timestamp fields are used by
        partitioning and sorting function to partition the data
        by grouping key and then sort the elements in a group by the
        timestamp
        """
    record_store_data = record_store_with_group_by_rdd.record_store_data
    group_by_columns_list = (record_store_with_group_by_rdd.
        group_by_columns_list)
    group_by_key_value = ''
    for gcol in group_by_columns_list:
        group_by_key_value = '^'.join((group_by_key_value, '='.join((gcol,
            eval('.'.join(('record_store_data', gcol)))))))
    return [[group_by_key_value, record_store_data.event_timestamp_string],
        record_store_data]
