Visitar URL original
datafusion-python/docs/source/index.md at main · voidstackloop/datafusion-python · GitHub
Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 2.63 KB

File metadata and controls

81 lines (60 loc) · 2.63 KB
jupytext
text_representation
extension format_name
.md
myst
kernelspec
name display_name
python3
Python 3

DataFusion in Python

This is a Python library that binds to Apache Arrow in-memory query engine DataFusion.

Like pyspark, it allows you to build a plan through SQL or a DataFrame API against in-memory data, parquet or CSV files, run it in a multi-threaded environment, and obtain the result back in Python.

It also allows you to use UDFs and UDAFs for complex operations.

The major advantage of this library over other execution engines is that this library achieves zero-copy between Python and its execution engine: there is no cost in using UDFs, UDAFs, and collecting the results to Python apart from having to lock the GIL when running those operations.

Its query engine, DataFusion, is written in Rust, which makes strong assumptions about thread safety and lack of memory leaks.

Technically, zero-copy is achieved via the c data interface.

Install

pip install datafusion

Example

from datafusion import SessionContext

ctx = SessionContext()

df = ctx.read_csv("pokemon.csv")

df.show()

Where to go next

  • User Guide — reading data, building queries, tuning execution, and distributing work.
  • Extension Guide — writing a library that plugs into DataFusion in Python: table providers, functions, extension codecs, and query planners.
  • Contributor Guide — changing datafusion-python itself.
:hidden: true
:maxdepth: 1

user-guide/index
extension-guide/index
contributor-guide/index
API Reference <autoapi/index>
links