def get_pings_properties(pings, paths, only_median=False, with_processes=False,
                         histograms_url=None, additional_histograms=None):
    """
    Returns a RDD of a subset of properties of pings. Child histograms are
    automatically merged with the parent histogram.

    If one of the paths points to a keyedHistogram name without supplying the
    actual key, returns a dict of all available subhistograms for that property.

    :param with_processes: should separate parent and child histograms be
                           included as well?
    :param paths: paths to properties in the payload, with levels separated by "/".
                  These can be supplied either as a list, eg.
                  ["application/channel", "payload/info/subsessionStartDate"],
                  or as the values of a dict keyed by custom identifiers, eg.
                  {"channel": "application/channel", "ssd": "payload/info/subsessionStartDate"}.
    :param histograms_url: see histogram.Histogram constructor
    :param additional_histograms: see histogram.Histogram constructor

    The returned RDD contains a dict for each ping with the required properties as values,
    keyed by the original paths (if 'paths' is a list) or the custom identifier keys
    (if 'paths' is a dict).
    """
    if isinstance(pings.first(), binary_type):
        pings = pings.map(lambda p: json.loads(p.decode('utf-8')))

    if isinstance(paths, str):
        paths = [paths]

    # Use '/' as dots can appear in keyed histograms
    if isinstance(paths, dict):
        paths = [(prop_name, path.split("/")) for prop_name, path in iteritems(paths)]
    else:
        paths = [(path, path.split("/")) for path in paths]

    return pings.map(lambda p: _get_ping_properties(p, paths, only_median,
                                                    with_processes,
                                                    histograms_url,
                                                    additional_histograms)) \
        .filter(lambda p: p)
def get_pings_properties ( pings , paths , only_median = False , with_processes = False , histograms_url = None , additional_histograms = None ) : if isinstance ( pings . first ( ) , binary_type ) : pings = pings . map ( lambda p : json . loads ( p . decode ( 'utf-8' ) ) ) if isinstance ( paths , str ) : paths = [ paths ] if isinstance ( paths , dict ) : paths = [ ( prop_name , path . split ( "/" ) ) for prop_name , path in iteritems ( paths ) ] else : paths = [ ( path , path . split ( "/" ) ) for path in paths ] return pings . map ( lambda p : _get_ping_properties ( p , paths , only_median , with_processes , histograms_url , additional_histograms ) ) . filter ( lambda p : p )
Returns a RDD of a subset of properties of pings. Child histograms are
    automatically merged with the parent histogram.

    If one of the paths points to a keyedHistogram name without supplying the
    actual key, returns a dict of all available subhistograms for that property.

    :param with_processes: should separate parent and child histograms be
                           included as well?
    :param paths: paths to properties in the payload, with levels separated by "/".
                  These can be supplied either as a list, eg.
                  ["application/channel", "payload/info/subsessionStartDate"],
                  or as the values of a dict keyed by custom identifiers, eg.
                  {"channel": "application/channel", "ssd": "payload/info/subsessionStartDate"}.
    :param histograms_url: see histogram.Histogram constructor
    :param additional_histograms: see histogram.Histogram constructor

    The returned RDD contains a dict for each ping with the required properties as values,
    keyed by the original paths (if 'paths' is a list) or the custom identifier keys
    (if 'paths' is a dict).