Apache Arrow JavaScript: check the bytes you send with an HTML report

Compare decoded values with the source specification before handing over Arrow data.

Your HTML table looks correct, but the downloadable data still needs to preserve the same identifiers and quantities. Serialize the Arrow table, read those bytes back, and compare the decoded columns before offering the file. A screenshot cannot check that round trip.

Use a fictional dispatch extract with item codes 0017 and 0023, carrying six and four units. Keep the codes as strings and the quantities as numeric values. The expected reading is two rows and ten units. These values are an exercise, not a shipment record.

Arrow IPC: original codes, decoded quantities and a checked reading
Arrow IPC: original codes, decoded quantities and a checked reading
Open the full example ↗

Open the complete example · Download the full HTML source

Create columns before creating a download

The Apache Arrow JavaScript README shows tableFromArrays for constructing a table and tableFromIPC for reading Arrow's interchange bytes. Its string-vector examples distinguish text from numeric storage. Give each field its intended representation instead of converting every value that resembles a number.

const table = Arrow.tableFromArrays({
  code: ['0017', '0023'],
  units: Int32Array.from([6, 4])
});
const bytes = Arrow.tableToIPC(table, 'file');
const decoded = Arrow.tableFromIPC(bytes);
const codes = Array.from(decoded.getChild('code'));
const units = Array.from(decoded.getChild('units'));

This core snippet assumes the chosen Arrow browser bundle has already exposed Arrow. It is not a complete HTML document. The serialization implementation defines tableToIPC's file and stream choices and its Uint8Array result. Choose the form deliberately and retain that choice beside the delivered data.

Compare decoded values with a separate expectation

Check decoded.numRows, both code strings, and both quantities. For this fixture, require two rows, 0017, 0023, six, and four. Then add the decoded quantities and require ten. A matching total alone would miss swapped quantities or a code that lost its zeros.

The acceptance values must come from the source specification, not from another rendering of the same decoded table. Otherwise the table and its checker can repeat the same mistake. Include the expected values as a short fixture assertion, and show an error instead of enabling a download when a comparison fails.

Use text nodes when displaying decoded cells. The existing CSV-to-HTML table guide covers table markup and narrow-screen reading. Arrow addresses the data representation and byte transfer before that presentation step; a columnar buffer does not supply a readable page by itself.

Send the reading copy and the working data together

Keep the HTML report, the Arrow bytes, and the source schema as distinct artifacts. Label the data link with its actual format, such as “Arrow IPC file.” Renaming the extension to .csv does not perform a conversion. Include the chosen Arrow package version so another developer can reproduce the reader.

If the page allows changing source rows, clear its previous acceptance message and retire the previous download immediately. Rebuild and recheck the bytes for the new rows before presenting a current result. A disabled download is preferable to a link whose label describes the new table while its content still contains the old data.

Test a changed code and quantity as well as the original fixture. Finally, open the delivered bytes through the recipient's actual reader and compare the two identifiers again. That last check establishes what their tool received; the browser's HTML table establishes what your page displayed.

Keep reading