Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

TransformExperimentalneeds: arrow

std:arrow-to-ndjson #

Converts Arrow record batches to records, refusing lossy values.

For example: read an Arrow stream as plain records.

A pipe is a data processing step with declared inputs and outputs; standard pipes are built into the runner.

Ports #

std:arrow-to-ndjson takes in and produces out.std:arrow-to-ndjsoninbatchesoutrecords
std:arrow-to-ndjson takes in and produces out.std:arrow-to-ndjsoninbatchesoutrecords
Named ports from the latest published contract. Dashed lines are optional ports.
Ports of std:arrow-to-ndjson
PortDirectionKindRequiredDescription
ininputbatchesyes
outoutputrecordsyes

Parameters #

This pipe has no parameters.

When to use it #

  • A pipe produces an Arrow IPC stream and the next one wants one JSON record per line.
  • Keep exact values on the way out: decimal128 and 64-bit integers are written as number literals with full precision, timestamps as RFC 3339 strings.

When to use something else

  • It is available only on runners that advertise the arrow capability. Input that is not an Arrow IPC stream is refused with E_FORMAT.

How it works #

Only where the runner has Arrow #

std:arrow-to-ndjson and std:ndjson-to-arrow convert between Arrow IPC streams (application/vnd.apache.arrow.stream) and item streams. Both declare requires: [arrow]: they exist only on runners that advertise the arrow capability, and a runner that claims conformance to the standard library does not have to. A runner without it rejects the pipeline at validation time with E_UNSUPPORTED. openflange version --capabilities shows what a runner offers.

What comes out #

One JSON record per line, with nothing rounded on the way:

  • decimal128 and 64-bit integers are written as JSON number literals with full precision;
  • timestamps become RFC 3339 strings, date32 becomes a YYYY-MM-DD string;
  • binary columns become base64 strings.

A value that cannot be preserved exactly, or input that is not an Arrow IPC stream at all, fails the run with E_FORMAT.

A tested example #

Nothing here is invented: this is the test “bytes that are not an Arrow IPC stream are refused” from the pipe's own portable test file, which every conformant runner must pass.

Parameters

This test sets no parameters.

Input: in
this is not arrow
Expected output: —

Expected result: the run fails with E_FORMAT. Nothing is written to the outputs.

The same step as a node of a pipeline.yaml:

pipeline.yaml
nodes:
  arrow-to-ndjson:
    pipe: std:arrow-to-ndjson
    inputs:
      in: {from: inputs.in}

This input is not plain records. A standalone pipeline.yaml cannot declare the kind of its inputs, so this node belongs in a pipe whose manifest declares the input in with kind batches, or after a node that produces that kind.

Notes from the manifest #

The pipe's manifest, OPENFLANGE.md, carries these notes.

Part of the OpenFlange standard library (std, version 0.1).

The explicit conversion from Arrow record batches (media type application/vnd.apache.arrow.stream) to JSON records. It is an optional capability (arrow): a runner without it rejects the pipe with E_UNSUPPORTED.

Every row becomes one JSON object with the columns in schema order. Supported column types and their JSON form (the inverse of std:ndjson-to-arrow):

Arrow type JSON
int8 … int64, uint8 … uint64 integer literal, full precision
float64 shortest number literal that round-trips; non-finite values are refused
utf8 string
bool true / false
binary base64 string
decimal128(p,s) number literal with exactly s fraction digits
timestamp[unit, UTC] RFC 3339 string with the unit's fraction digits (0, 3, 6 or 9), Z suffix
date32 YYYY-MM-DD string

Null values become JSON null. A stream containing any other column type (nested types, dictionaries, float32, timestamps without the UTC zone …) is refused with E_UNSUPPORTED rather than converted approximately. A malformed or empty stream is E_FORMAT, as are two columns with the same name. State is bounded by one record batch of the input.

Reference #

Maturity
Experimental
Needs the runner capability
arrow
Processing scope
record
Manifest version
0.1.0