Apache Arrow in JS
Arrow is a set of technologies that enable big data systems to process and transfer data quickly.
npm install apache-arrow
or yarn add apache-arrow
(read about how we package apache-arrow below)
Apache Arrow is a columnar memory layout specification for encoding vectors and table-like containers of flat and nested data. The Arrow spec aligns columnar data in memory to minimize cache misses and take advantage of the latest SIMD (Single input multiple data) and GPU operations on modern processors.
Apache Arrow is the emerging standard for large in-memory columnar data (Spark, Pandas, Drill, Graphistry, ...). By standardizing on a common binary interchange format, big data systems can reduce the costs and friction associated with cross-system communication.
Check out our API documentation to learn more about how to use Apache Arrow's JS implementation. You can also learn by example by checking out some of the following resources:
- Observable: Introduction to Apache Arrow
- Observable: Manipulating flat arrays arrow-style
- Observable: Rich columnar data tables - Dictionary-encoded strings, 64bit ints, and nested structs
- /js/test/unit - Unit tests for Table and Vector
import { readFileSync } from 'fs';
import { Table } from 'apache-arrow';
const arrow = readFileSync('simple.arrow');
const table = Table.from([arrow]);
console.log(table.toString());
/*
foo, bar, baz
1, 1, aa
null, null, null
3, null, null
4, 4, bbb
5, 5, cccc
*/
import { readFileSync } from 'fs';
import { Table } from 'apache-arrow';
const table = Table.from([
'latlong/schema.arrow',
'latlong/records.arrow'
].map((file) => readFileSync(file)));
console.log(table.toString());
/*
origin_lat, origin_lon
35.393089294433594, -97.6007308959961
35.393089294433594, -97.6007308959961
35.393089294433594, -97.6007308959961
29.533695220947266, -98.46977996826172
29.533695220947266, -98.46977996826172
*/
import {
Table,
FloatVector,
DateVector
} from 'apache-arrow';
const LENGTH = 2000;
const rainAmounts = Float32Array.from(
{ length: LENGTH },
() => Number((Math.random() * 20).toFixed(1)));
const rainDates = Array.from(
{ length: LENGTH },
(_, i) => new Date(Date.now() - 1000 * 60 * 60 * 24 * i));
const rainfall = Table.new(
[FloatVector.from(rainAmounts), DateVector.from(rainDates)],
['precipitation', 'date']
);
import { Table } from "apache-arrow";
const table = await Table.from(fetch("/simple.arrow"));
console.log(table.toString());
import { readFileSync } from 'fs';
import { Table } from 'apache-arrow';
const table = Table.from([
'latlong/schema.arrow',
'latlong/records.arrow'
].map(readFileSync));
const column = table.getColumn('origin_lat');
// Copy the data into a TypedArray
const typed = column.toArray();
assert(typed instanceof Float32Array);
for (let i = -1, n = column.length; ++i < n;) {
assert(column.get(i) === typed[i]);
}
See DEVELOP.md
Even if you do not plan to contribute to Apache Arrow itself or Arrow integrations in other projects, we'd be happy to have you involved:
- Join the mailing list: send an email to [email protected]. Share your ideas and use cases for the project.
- Follow our activity on JIRA
- Learn the format
- Contribute code to one of the reference implementations
We prefer to receive contributions in the form of GitHub pull requests. Please send pull requests against the github.com/apache/arrow repository.
If you are looking for some ideas on what to contribute, check out the JIRA issues for the Apache Arrow project. Comment on the issue and/or contact [email protected] with your questions and ideas.
If you’d like to report a bug but don’t have time to fix it, you can still post it on JIRA, or email the mailing list [email protected]
apache-arrow
is written in TypeScript, but the project is compiled to multiple JS versions and common module formats.
The base apache-arrow
package includes all the compilation targets for convenience, but if you're conscientious about your node_modules
footprint, we got you.
The targets are also published under the @apache-arrow
namespace:
npm install apache-arrow # <-- combined es2015/UMD + esnext/CommonJS/ESModules/UMD
npm install @apache-arrow/ts # standalone TypeScript package
npm install @apache-arrow/es5-cjs # standalone es5/CommonJS package
npm install @apache-arrow/es5-esm # standalone es5/ESModules package
npm install @apache-arrow/es5-umd # standalone es5/UMD package
npm install @apache-arrow/es2015-cjs # standalone es2015/CommonJS package
npm install @apache-arrow/es2015-esm # standalone es2015/ESModules package
npm install @apache-arrow/es2015-umd # standalone es2015/UMD package
npm install @apache-arrow/esnext-cjs # standalone esNext/CommonJS package
npm install @apache-arrow/esnext-esm # standalone esNext/ESModules package
npm install @apache-arrow/esnext-umd # standalone esNext/UMD package
The JS community is a diverse group with a varied list of target environments and tool chains. Publishing multiple packages accommodates projects of all stripes.
If you think we missed a compilation target and it's a blocker for adoption, please open an issue.
The bundles we compile support moderns browser released in the last 5 years. This includes supported versions of Firefox, Chrome, Edge, and Safari. We do not actively support Internet Explorer. Apache Arrow also works on maintained versions of Node.
Full list of broader Apache Arrow committers.
- Brian Hulette, committer
- Paul Taylor, committer
- Dominik Moritz, committer
Full list of broader Apache Arrow projects & organizations.
- Apache Arrow -- Parent project for Powering Columnar In-Memory Analytics, including affiliated open source projects
- Perspective -- Perspective is a streaming data visualization engine by J.P. Morgan for JavaScript for building real-time & user-configurable analytics entirely in the browser.
- Falcon is a visualization tool for linked interactions across multiple aggregate visualizations of millions or billions of records.
- Vega is an ecosystem of tools for interactive visualizations on the web. The Vega team implemented an Arrow loader.
- Arquero is a library for query processing and transformation of array-backed data tables.
- OmniSci is a GPU database. Its JavaScript connector returns Arrow dataframes.