2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
20 # [Apache Arrow](https://github.com/apache/arrow) in JS
22 [![npm version](https://img.shields.io/npm/v/apache-arrow.svg)](https://www.npmjs.com/package/apache-arrow)
24 Arrow is a set of technologies that enable big data systems to process and transfer data quickly.
26 ## Install `apache-arrow` from NPM
28 `npm install apache-arrow` or `yarn add apache-arrow`
30 (read about how we [package apache-arrow](#packaging) below)
32 # Powering Columnar In-Memory Analytics
34 [Apache Arrow](https://github.com/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.
36 Apache Arrow is the emerging standard for large in-memory columnar data ([Spark](https://spark.apache.org/), [Pandas](https://wesmckinney.com/blog/pandas-and-apache-arrow/), [Drill](https://drill.apache.org/), [Graphistry](https://www.graphistry.com), ...). By standardizing on a common binary interchange format, big data systems can reduce the costs and friction associated with cross-system communication.
40 Check out our [API documentation][7] 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:
42 * [Observable: Introduction to Apache Arrow][5]
43 * [Observable: Manipulating flat arrays arrow-style][6]
44 * [Observable: Rich columnar data tables - Dictionary-encoded strings, 64bit ints, and nested structs][8]
45 * [/js/test/unit](https://github.com/apache/arrow/tree/master/js/test/unit) - Unit tests for Table and Vector
49 ### Get a table from an Arrow file on disk (in IPC format)
52 import { readFileSync } from 'fs';
53 import { Table } from 'apache-arrow';
55 const arrow = readFileSync('simple.arrow');
56 const table = Table.from([arrow]);
58 console.log(table.toString());
70 ### Create a Table when the Arrow file is split across buffers
73 import { readFileSync } from 'fs';
74 import { Table } from 'apache-arrow';
76 const table = Table.from([
77 'latlong/schema.arrow',
78 'latlong/records.arrow'
79 ].map((file) => readFileSync(file)));
81 console.log(table.toString());
84 origin_lat, origin_lon
85 35.393089294433594, -97.6007308959961
86 35.393089294433594, -97.6007308959961
87 35.393089294433594, -97.6007308959961
88 29.533695220947266, -98.46977996826172
89 29.533695220947266, -98.46977996826172
93 ### Create a Table from JavaScript arrays
100 } from 'apache-arrow';
104 const rainAmounts = Float32Array.from(
106 () => Number((Math.random() * 20).toFixed(1)));
108 const rainDates = Array.from(
110 (_, i) => new Date(Date.now() - 1000 * 60 * 60 * 24 * i));
112 const rainfall = Table.new(
113 [FloatVector.from(rainAmounts), DateVector.from(rainDates)],
114 ['precipitation', 'date']
118 ### Load data with `fetch`
121 import { Table } from "apache-arrow";
123 const table = await Table.from(fetch("/simple.arrow"));
124 console.log(table.toString());
128 ### Columns look like JS Arrays
131 import { readFileSync } from 'fs';
132 import { Table } from 'apache-arrow';
134 const table = Table.from([
135 'latlong/schema.arrow',
136 'latlong/records.arrow'
137 ].map(readFileSync));
139 const column = table.getColumn('origin_lat');
141 // Copy the data into a TypedArray
142 const typed = column.toArray();
143 assert(typed instanceof Float32Array);
145 for (let i = -1, n = column.length; ++i < n;) {
146 assert(column.get(i) === typed[i]);
152 See [DEVELOP.md](DEVELOP.md)
154 Even if you do not plan to contribute to Apache Arrow itself or Arrow
155 integrations in other projects, we'd be happy to have you involved:
157 * Join the mailing list: send an email to
158 [dev-subscribe@arrow.apache.org][1]. Share your ideas and use cases for the
160 * [Follow our activity on JIRA][3]
161 * [Learn the format][2]
162 * Contribute code to one of the reference implementations
164 We prefer to receive contributions in the form of GitHub pull requests. Please send pull requests against the [github.com/apache/arrow][4] repository.
166 If you are looking for some ideas on what to contribute, check out the [JIRA
167 issues][3] for the Apache Arrow project. Comment on the issue and/or contact
168 [dev@arrow.apache.org](https://mail-archives.apache.org/mod_mbox/arrow-dev/)
169 with your questions and ideas.
171 If you’d like to report a bug but don’t have time to fix it, you can still post
172 it on JIRA, or email the mailing list
173 [dev@arrow.apache.org](https://mail-archives.apache.org/mod_mbox/arrow-dev/)
177 `apache-arrow` is written in TypeScript, but the project is compiled to multiple JS versions and common module formats.
179 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.
181 The targets are also published under the `@apache-arrow` namespace:
184 npm install apache-arrow # <-- combined es2015/CommonJS/ESModules/UMD + esnext/UMD
185 npm install @apache-arrow/ts # standalone TypeScript package
186 npm install @apache-arrow/es5-cjs # standalone es5/CommonJS package
187 npm install @apache-arrow/es5-esm # standalone es5/ESModules package
188 npm install @apache-arrow/es5-umd # standalone es5/UMD package
189 npm install @apache-arrow/es2015-cjs # standalone es2015/CommonJS package
190 npm install @apache-arrow/es2015-esm # standalone es2015/ESModules package
191 npm install @apache-arrow/es2015-umd # standalone es2015/UMD package
192 npm install @apache-arrow/esnext-cjs # standalone esNext/CommonJS package
193 npm install @apache-arrow/esnext-esm # standalone esNext/ESModules package
194 npm install @apache-arrow/esnext-umd # standalone esNext/UMD package
197 ### Why we package like this
199 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.
201 If you think we missed a compilation target and it's a blocker for adoption, please open an issue.
203 ### Supported Browsers and Platforms
205 The bundles we compile support moderns browser released in the last 5 years. This includes supported versions of
206 Firefox, Chrome, Edge, and Safari. We do not actively support Internet Explorer.
207 Apache Arrow also works on [maintained versions of Node](https://nodejs.org/en/about/releases/).
211 Full list of broader Apache Arrow [committers](https://arrow.apache.org/committers/).
213 * Brian Hulette, _committer_
214 * Paul Taylor, _committer_
215 * Dominik Moritz, _committer_
217 # Powered By Apache Arrow in JS
219 Full list of broader Apache Arrow [projects & organizations](https://arrow.apache.org/powered_by/).
221 ## Open Source Projects
223 * [Apache Arrow](https://arrow.apache.org) -- Parent project for Powering Columnar In-Memory Analytics, including affiliated open source projects
224 * [Perspective](https://github.com/jpmorganchase/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.
225 * [Falcon](https://github.com/uwdata/falcon) is a visualization tool for linked interactions across multiple aggregate visualizations of millions or billions of records.
226 * [Vega](https://github.com/vega) is an ecosystem of tools for interactive visualizations on the web. The Vega team implemented an [Arrow loader](https://github.com/vega/vega-loader-arrow).
227 * [Arquero](https://github.com/uwdata/arquero) is a library for query processing and transformation of array-backed data tables.
228 * [OmniSci](https://github.com/omnisci/mapd-connector) is a GPU database. Its JavaScript connector returns Arrow dataframes.
232 [Apache 2.0](https://github.com/apache/arrow/blob/master/LICENSE)
234 [1]: mailto:dev-subscribe@arrow.apache.org
235 [2]: https://github.com/apache/arrow/tree/master/format
236 [3]: https://issues.apache.org/jira/browse/ARROW
237 [4]: https://github.com/apache/arrow
238 [5]: https://beta.observablehq.com/@theneuralbit/introduction-to-apache-arrow
239 [6]: https://beta.observablehq.com/@lmeyerov/manipulating-flat-arrays-arrow-style
240 [7]: https://arrow.apache.org/docs/js/
241 [8]: https://observablehq.com/@lmeyerov/rich-data-types-in-apache-arrow-js-efficient-data-tables-wit