xxxxxxxxxx
# Reading an ORC file into a DataFrame
file = "your_orc_file_path"
df = spark.read.format("orc").option("path", file).load()
df.show()
# Reading an ORC file into a Spark SQL table
spark.sql("""CREATE OR REPLACE TEMPORARY VIEW name_of_view
USING orc
OPTIONS (
path "your_orc_file_path"
)""")
# Writing DataFrames to ORC files
(df.write.format("orc")
.mode("overwrite")
.option("compression", "snappy")
.save("save_location_path"))