Skip to content

Latest commit

 

History

History
71 lines (45 loc) · 2.5 KB

README.md

File metadata and controls

71 lines (45 loc) · 2.5 KB

Apache Gandiva for WebAssembly

CI Action

This project brings Apache Gandiva to WebAssembly. Gandiva is a LLVM-based expression compiler and a high-performance execution environment for data processing on Apache Arrow buffers.

It allows building complex filter and map expressions, and just-in-time compilation to machine code (or, in our case, WebAssembly). The resulting expressions can be executed very efficiently, since the compiled code has minimal runtime overhead and maximizes the use of fast CPU caches.

Gandiva for WebAssembly is built using Emscripten. It depends on the upstream LLVM project, and contains minor modifications to Gandiva to make it operational in WebAssembly. Specifically, the project contains fixes for platform-agnostic handling of pointers in generated code and adjustments to accomplish dynamic linking on WebAssembly. It works by instantiating WebAssembly modules on the host system and links modules via function imports and an indirect function table.

Demo

This project contains a small demo, allowing you to build and execute expression trees in your browser:

Apache Gandiva for WebAssembly Demo

Launch Gandiva demo in your browser

Currently, only browsers which implement exception handling in WebAssembly are supported.

API

To interact with Gandiva from JavaScript, have a look at the list of functions available in our host bindings.

Development

Build the development container which includes all dependencies necessary for building:

docker build - < Dockerfile

Build Gandiva's OpenSSL dependency for WebAssembly:

$ ./scripts/build_openssl.sh [debug|release]

Build Gandiva's LLVM dependency for WebAssembly:

$ ./scripts/build_llvm.sh [debug|release]

Build Gandiva for WebAssembly:

$ ./scripts/build.sh [debug|release]

Bundle Gandiva as a JavaScript module:

$ npm run build:[debug|release]

Run tests:

$ npm run test:node

Run benchmarks:

$ npm run benchmark:[browser|node]