orc (DataFrameReader)

Charge les fichiers ORC et retourne le résultat sous la forme d’un DataFramefichier .

Syntaxe

orc(path, **options)

Paramètres

Paramètre Type Description
path str ou list Un ou plusieurs chemins d’accès d’entrée.

Retours

DataFrame

Exemples

Écrivez un DataFrame dans un fichier ORC et lisez-le.

import tempfile
with tempfile.TemporaryDirectory(prefix="orc") as d:
    spark.createDataFrame(
        [{"age": 100, "name": "Alice"}]
    ).write.mode("overwrite").format("orc").save(d)

    spark.read.orc(d).show()
    # +---+------------+
    # |age|        name|
    # +---+------------+
    # |100|Alice|
    # +---+------------+