def get_pings(sc, app=None, build_id=None, channel=None, doc_type='saved_session',
              fraction=1.0, schema=None, source_name='telemetry', source_version='4',
              submission_date=None, version=None):
    """ Returns a RDD of Telemetry submissions for a given filtering criteria.

    :param sc: an instance of SparkContext
    :param app: an application name, e.g.: "Firefox"
    :param channel: a channel name, e.g.: "nightly"
    :param version: the application version, e.g.: "40.0a1"
    :param build_id: a build_id or a range of build_ids, e.g.:
                     "20150601000000" or ("20150601000000", "20150610999999")
    :param submission_date: a submission date or a range of submission dates, e.g:
                            "20150601" or ("20150601", "20150610")
    :param source_name: source name, set to "telemetry" by default
    :param source_version: source version, set to "4" by default
    :param doc_type: ping type, set to "saved_session" by default
    :param schema: (deprecated) version of the schema to use
    :param fraction: the fraction of pings to return, set to 1.0 by default
    """
    if schema:
        print("The 'schema' parameter is deprecated. "
              "Version 4 is now the only schema supported.")
        if schema != "v4":
            raise ValueError("Invalid schema version")

    dataset = Dataset.from_source('telemetry')

    filters = (
        ('docType', doc_type),
        ('sourceName', source_name),
        ('sourceVersion', source_version),
        ('appName', app),
        ('appUpdateChannel', channel),
        ('appVersion', version),
    )

    for key, condition in filters:
        if condition and condition != '*':
            dataset = dataset.where(**{key: condition})

    # build_id and submission_date can be either strings or tuples or lists,
    # so they deserve a special treatment
    special_cases = dict(appBuildId=build_id, submissionDate=submission_date)

    def range_compare(min_val, max_val, val):
        return min_val <= val <= max_val

    for key, value in iteritems(special_cases):
        if value is not None and value != '*':
            if isinstance(value, string_types):
                condition = value
            elif isinstance(value, (list, tuple)) and len(value) == 2:
                start, end = value
                condition = partial(range_compare, start, end)
            else:
                raise ValueError(('{} must be either a string or a 2 elements '
                                  'list/tuple'. format(key)))
            dataset = dataset.where(**{key: condition})

    return dataset.records(sc, sample=fraction)
Returns a RDD of Telemetry submissions for a given filtering criteria.

    :param sc: an instance of SparkContext
    :param app: an application name, e.g.: "Firefox"
    :param channel: a channel name, e.g.: "nightly"
    :param version: the application version, e.g.: "40.0a1"
    :param build_id: a build_id or a range of build_ids, e.g.:
                     "20150601000000" or ("20150601000000", "20150610999999")
    :param submission_date: a submission date or a range of submission dates, e.g:
                            "20150601" or ("20150601", "20150610")
    :param source_name: source name, set to "telemetry" by default
    :param source_version: source version, set to "4" by default
    :param doc_type: ping type, set to "saved_session" by default
    :param schema: (deprecated) version of the schema to use
    :param fraction: the fraction of pings to return, set to 1.0 by default