Simple type-safe relational algebra evaluator built entirely in Rust

Overview

ra-evaluator

A simple type-safe relational algebra evaluator.

Relational algebra provides the theoretical foundation for relational databases and the SQL language. This library provides a means to build expressions in the language of relational algebra and evaluate them to obtain a concrete result.

Features

  • Type safe and generic expressions operating on arbitrary tuples and structs.
  • Highly composable expression building based on the composite design pattern.
  • Recursive evaluation of complex chained expressions.

Future Possible Features

  • Visualization of expression trees.
  • Query rewriting and optimization.

Sample Usage

We can build relational algebra expressions using the ExpressionBuilder struct:

use ra_evaluator::{ExpressionBuilder, Terminal};

let query = ExpressionBuilder::new(Terminal::new(&[(1, "a"), (2, "b"), (3, "c")]))
    .select(|x| x.0 > 1)
    .project(|x| x.1)
    .cartesian_product(&[1, 2], |x, y| (*x, *y))
    .join(&[(1, "Join1"), (2, "Join2")], |x, y| x.1 == y.0, |x, y| (x.0, y.0, y.1))
    .union(&[("d", 3, "Union")])
    .intersect(&[
        ("c", 1, "Join1"),
        ("c", 2, "Join2"),
        ("d", 3, "Union"),
        ("e", 4, "Removed"),
    ]);
 
// Results in ``[("c", 1, "Join1"), ("c", 2, "Join2"), ("d", 3, "Union")]``
println!("{:?}", query.eval());
You might also like...
A Rust library with homemade machine learning models to classify the MNIST dataset. Built in an attempt to get familiar with advanced Rust concepts.

mnist-classifier Ideas UPDATED: Finish CLI Flags Parallelize conputationally intensive functions Class-based naive bayes README Image parsing Confusio

Simulation of sand falling down in a cave built using nannou (Rust)
Simulation of sand falling down in a cave built using nannou (Rust)

nannou-sand-simulation Learning nannou, an open-source creative-coding toolkit for Rust, by implementing a visualization for a simulation of sand fall

Simple neural network library for classification written in Rust.

Cogent A note I continue working on GPU stuff, I've made some interesting things there, but ultimately it made me realise this is far too monumental a

Simple Neural Network on rust

Simple Artificial Neural Network A crate that implements simple usage of dense neural networks. Instalation Add this to your dependencies on Cargo.tom

A simple bayesian spam classifier written in Rust.

bayespam A simple bayesian spam classifier. About Bayespam is inspired by Naive Bayes classifiers, a popular statistical technique of e-mail filtering

This repository features a simple Kalman filter and RTS smoother (KFS) implementation in Rust by using the ndarray library.
This repository features a simple Kalman filter and RTS smoother (KFS) implementation in Rust by using the ndarray library.

Kalman filter and RTS smoother in Rust (ndarray) This repository features a simple Kalman filter and RTS smoother (KFS) implementation in Rust by usin

Mars is a rust machine learning library. [Goal is to make Simple as possible]
Mars is a rust machine learning library. [Goal is to make Simple as possible]

Mars Mars (ma-rs) is an blazingly fast rust machine learning library. Simple and Powerful! 🦀 🚀 Contribution: Feel free to build this project. This i

A simple neural net implementation.

PROPHET - Neural Network Library Linux Windows Codecov Coveralls Docs Crates.io A simple neural net implementation written in Rust with a focus on cac

A simple url checker for finding fraud url(s) or nearest url

urlchecker A simple url checker for finding fraud url(s) or nearest url while being fast (threading) Eg:- use std::collections::HashMap; use urlchecke

Owner
Vincent Wong
UNSW Computer Science and Mathematics student.
Vincent Wong
Cleora AI is a general-purpose model for efficient, scalable learning of stable and inductive entity embeddings for heterogeneous relational data.

Cleora Cleora is a genus of moths in the family Geometridae. Their scientific name derives from the Ancient Greek geo γῆ or γαῖα "the earth", and metr

Synerise 405 Dec 20, 2022
A linear algebra library written in Rust

rulinalg This library is no longer actively maintained The crate is currently on version 0.4.2. Read the API Documentation to learn more. Summary Ruli

James Lucas 264 Jan 2, 2023
Linear algebra crate for Rust.

cayley - generic, stack-allocated linear algebra in Rust cayley is a crate that fills a small niche: it provides a generic matrix type that allocates

Simeon Duwel 6 Apr 3, 2023
Static Linear Algebra System

SLAS Static Linear Algebra System Provides statically allocated vector, matrix and tensor types, for interfacing with blas/blis, in a performant manor

Aksel? 34 Dec 13, 2022
`dfx new --type=rust` + burn-rs MNIST web inference example

ic-mnist The frontend provides a canvas where users can draw a digit. The drawn digit is then sent to the backend canister running burn-rs for inferen

Marcin Nowak-Liebiediew 4 Jun 25, 2023
SelfOrgMap 5 Nov 4, 2020
Using OpenAI Codex's "davinci-edit" Model for Gradual Type Inference

OpenTau: Using OpenAI Codex for Gradual Type Inference Current implementation is focused on TypeScript Python implementation comes next Requirements r

Gamma Tau 11 Dec 18, 2022
Simple WIP GPGPU framework for Rust built on top of wgpu

gpgpu A simple GPU compute library based on wgpu. It is meant to be used alongside wgpu if desired. To start using gpgpu, just create a Framework inst

Jerónimo Sánchez 97 Dec 26, 2022
A fast, safe and easy to use reinforcement learning framework in Rust.

RSRL (api) Reinforcement learning should be fast, safe and easy to use. Overview rsrl provides generic constructs for reinforcement learning (RL) expe

Thomas Spooner 139 Dec 13, 2022
A safe Rust wrapper around a subset of cuFFT.

cufft_rust This is a safe Rust wrapper around CUDA FFT (cuFFT). It only supports a subset of the API which I need for private projects. For now this o

Pim van den Berg 1 Jan 11, 2022