This is a (very) rough prototype for SQL optimization in OCaml.
You will first need to install OCaml and OPAM.
On macOS with Homebrew
brew intall ocaml
brew install opam
Clone this project
git clone https://github.com/richardwu/better-sql.git
and run
make setup
make build
To interactively test this, simply download utop, and load the necessary definitions from the source files. For example (in topological order of dependencies):
#use "table.ml";;
#use "columnsPerTable.ml";;
#use "columns.ml";;
#use "expr.ml";;
open Expr;; (* elides the need to prefix with module name *)
let e1 = fromOp(SCAN(Table.fromName "a"));;
Columns.prettyprint (columns e1);;
make test