NAME

PDL::IO::Arrow - Read and write PDL ndarrays via Apache Arrow and Parquet

VERSION

Version 0.01

SYNOPSIS

use PDL;
use PDL::IO::Arrow qw(rarrow warrow rparquet wparquet);

# Read Arrow IPC or Parquet columnar data into PDL ndarrays
my $cols = rparquet('events.parquet');
my $scores = $cols->{score};

# Write named PDL columns to Parquet or Arrow IPC
wparquet({ id => long([1, 2, 3]), val => double([0.5, 1.5, 2.5]) }, 'out.parquet');
warrow({ id => long([1, 2, 3]), val => double([0.5, 1.5, 2.5]) }, 'out.arrow');

DESCRIPTION

PDL::IO::Arrow provides a unified PDL::IO interface to Apache Arrow IPC and Apache Parquet columnar datasets backed by Apache Arrow C++ (libarrow and libparquet). It is designed for columnar data interchange between PDL (and Data::Frame) and external analytics engines such as Apache Spark (Spark Connect), BigQuery Storage Read API, DuckDB, and RAPIDS cuDF.

FUNCTIONS

rarrow

Read an Apache Arrow IPC file into a hashref of named PDL ndarrays.

$cols = rarrow($filename);
my $cols = rarrow('events.arrow');
my $scores = $cols->{score};

Reads all numeric (including complex) columns from the Apache Arrow IPC file at $filename and returns a hashref mapping column names to 1-D PDL ndarrays.

warrow

Write a hashref of named PDL ndarrays to an Apache Arrow IPC file.

warrow(\%columns, $filename);
warrow({ id => long([1, 2, 3]), val => double([0.5, 1.5, 2.5]) }, 'out.arrow');

Writes the named PDL ndarrays in \%columns to an Apache Arrow IPC file at $filename.

rparquet

Read an Apache Parquet file into a hashref of named PDL ndarrays.

$cols = rparquet($filename);
my $cols = rparquet('events.parquet');
my $scores = $cols->{score};

Reads all numeric (including complex) columns from the Apache Parquet file at $filename via libparquet and returns a hashref mapping column names to 1-D PDL ndarrays.

wparquet

Write a hashref of named PDL ndarrays to an Apache Parquet file.

wparquet(\%columns, $filename);
wparquet({ id => long([1, 2, 3]), val => double([0.5, 1.5, 2.5]) }, 'out.parquet');

Writes the named PDL ndarrays in \%columns to an Apache Parquet file at $filename via libparquet.

arrow2pdl_type

Map an Apache Arrow type name to the corresponding PDL type name.

$pdl_type = arrow2pdl_type($arrow_type);

Maps an Apache Arrow primitive or complex type name (e.g. float64, float32, int32, int64, uint8, bool, complex64, complex128) to the corresponding PDL::Type name.

pdl2arrow_type

Map a PDL type name or PDL::Type object to an Apache Arrow type name.

$arrow_type = pdl2arrow_type($pdl_type);

Maps a PDL::Type object or type name to the corresponding Apache Arrow type name.

TYPE MAPPING

  • float64 <=> double

  • float32 <=> float

  • int8 <=> sbyte

  • uint8 / bool <=> byte

  • int16 <=> short

  • uint16 <=> ushort

  • int32 <=> long

  • uint32 <=> ulong

  • int64 <=> longlong

  • uint64 <=> ulonglong

SEE ALSO

PDL, PDL::IO::Protobuf, Data::Frame, Protobuf

AUTHOR

C.J. Collier <cjac@google.com>

LICENSE AND COPYRIGHT

Copyright (c) 2026 Google LLC and contributors.

This program is released under the Apache License, Version 2.0.