def _text_file_with_path(sc, path):
    """Return an RDD that yields (path, line) for each line in the file.

    *path* must be a single path, not a comma-separated list of paths
    """
    from pyspark.sql import SparkSession
    from pyspark.sql import functions as F
    spark = SparkSession(sc)
    df = spark.read.text(path).select([F.input_file_name().alias(
        'input_file_name'), F.col('value')])
    return df.rdd.map(lambda row: (row.input_file_name, row.value if
        isinstance(row.value, bytes) else row.value.encode('utf_8')))
