GithubHelp home page GithubHelp logo

framed's Introduction

Framed: Typed Dataframe for Scala 3

It's clearly possible to implement a dataframe library in Scala---Spark has one, for example. What's not clear is if it's possible to implement one that uses the type system to prevent common errors. For example, in Spark it's a runtime error to select a column that doesn't exist (Spark has typed dataframes but in practice they are unusable; all real systems I know of use the untyped dataframes). Can this be prevented at compile time? If so, it seems it could be a significant UX improvement over current systems.

This project is an experiment in creating a typed dataframe in Scala 3. Scala 3's compile-time metaprogramming features should make this possible in a way that was not achievable in Scala 2 with reasonable UX.

There are two goals for this project:

  1. Show it's possible to implement a typed dataframe in Scala 3
  2. Show that such a dataframe is usable---compile times are reasonable and error messages are not incomprehensible

Basic Design

The key idea is to represent a dataframe as a tuple or heterogeneous list. Each element in the tuple is a column in the dataframe. At the type level we store, for each column, the type of the data in the column and the name of the column as a String type literal. Operations on dataframes can then be expressed as structural recursion at the type level over this representation, probably using match types.

To prove this can actually work it should be sufficient to implement a few core methods:

  • selecting a column by name
  • selecting several columns by name
  • adding a column
  • dropping a column
  • joining two dataframes (maybe just inner join to start with?)

If these methods can be implemented I'm confident that it will be possible to implement other methods using the same techniques. This meets goal 1.

API Design

To meet goal 2 requires careful API design. It's not clear what the final API should be, nor what techniques will be necessary to present it a way that will be usable by data scientists (who are usually not Scala experts.)

Should look to the literature for API design. See the reading below.

Reading

I'm not really familiar with the literature on typed dataframes. Presumably it exists---it's such an obvious thing to look at---but I haven't found much. Here are some papers that look interesting:

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.