Coder Social home page Coder Social logo

rust-dataframe's Introduction

Rust DataFrame

A dataframe implementation in Rust, powered by Apache Arrow.

What is a dataframe?

A dataframe is a 2-dimensional tabular data structure that is often used for computations and other data transformations. A dataframe often has columns of the same data type, similar to a SQL table.

Functionality

This project is inspired by Pandas and other dataframe libraries, but specifically currently borrows functions from Apache Spark.

It mainly focuses on computation, and aims to include:

  • Scalar functions
  • Aggregate function
  • Window functions
  • Array functions

As a point of reference, we use Apache Spark Python functions for function parity, and aim to be compatible with Apache Spark functions.

Eager vs Lazy Evaluation

The initial experiments of this project were to see if it's possible to create some form of dataframe. We're happy that this condition is met, however the initial version relied on eager evaluation, which would make it difficult to use in a REPL fashion, and make it slow.

We are mainly focusing on creating a process for lazy evaluation (the current LazyFrame), which involves reading an input's schema, then applying transformations on that schema until a materialising action is required. While still figuring this out, there might not be much progress on the surface, as most of this exercise is happening offline.

The plan is to provide a reasonable API for lazily transforming data, and the ability to apply some optimisations on the computation graph (e.g. predicate pushdown, rearranging computations).

In the future, LazyFrame will probably be renamed to DataFrame, and the current DataFrame with eager evaluation removed/made private.

The ongoing experiments on lazy evaluation are in the master branch, and we would appreciate some help ๐Ÿ™๐Ÿพ.

Non-Goals

Although we use Apache Spark as a reference, we do not intend on supporting distributed computation beyond a single machine.

Spark is a convenience to reduce bikeshedding, but we will probably provide a more Rust idiomatic API in future.

Status

A low-level API can already be used for simple tasks that do not require aggregations, joins or sorts. A simpler API is currently not a priority until we have more capabilities to transform data.

One good potential immediate use of the library would be copying data from one supported data source to another (e.g. PostgreSQL to Arrow or CSV with minimal transformations).

Roadmap

  • Lazy evaluation (H1 2020)
    • Aggregations
    • Joins
    • Sorting
  • Adding compute fns (H1 2020)
  • Bindings to other languages (H2 2020)

IO

We are working on IO support, with priority for SQL read and write. PostgreSQL IO is supported using the binary protocol, although not all data types are supported (lists, structs, numeric, and a few other non-primitive types)

  • IO Support
    • CSV
      • Read
      • Write
    • JSON
      • Read
      • Write
    • Arrow IPC
      • Read File
      • Write FIle
    • Parquet
      • Read File
      • Write File
    • SQL (part of an effort to create generic DB traits)
      • PostgreSQL (Primitive and temporal types supported, PRs welcome for other types)
        • Read
        • Write
      • MSSQL (using tiberius)
        • Read
        • Write
      • MySQL
        • Read
        • Write

Functionality

  • DataFrame Operations

    • Select single column
    • Select subset of columns, drop columns
    • Add or remove columns
    • Rename columns
    • Create dataframe from record batches (a Vec<RecordBatch> as well as an iterator)
    • Sort dataframes
    • Grouped operations
    • Filter dataframes
    • Join dataframes
  • Scalar Functions

    • Trig functions (sin, cos, tan, asin, asinh, ...) (using the num crate where possible)
    • Basic arithmetic (add, mul, divide, subtract) Implemented from Arrow
    • Date/Time functions
    • String functions
      • [-] Basic string manipulation
      • Regular expressions (leveraging regex)
      • Casting to and from strings (using Arrow compute's cast kernel)
    • Crypto/hash functions (md5, crc32, sha{x}, ...)
    • Other functions (that we haven't classified)
  • Aggregate Functions

    • Sum, max, min
    • Count
    • Statistical aggregations (mean, mode, median, stddev, ...)
  • Window Functions

    • Lead, lag
    • Rank, percent rank
    • Other
  • Array Functions

    • Compatibility with Spark 2.4 functions
    • Compatibility with Spark 3.0 functions

Performance

We plan on providing simple benchmarks in the near future. The current blockers are:

  • IO
    • Text format (CSV)
    • Binary format (Arrow IPC)
    • SQL
  • [-] Lazy operations
  • Aggregation
  • Joins

rust-dataframe's People

Contributors

nevi-me avatar houqp avatar jbpratt avatar

Watchers

Martin Felder avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.