deephaven.arrow

This module supports conversions between pyarrow tables and Deephaven tables.

SUPPORTED_ARROW_ENCODINGS = (<class 'pyarrow.lib.DictionaryType'>, <class 'pyarrow.lib.RunEndEncodedType'>)

The pyarrow type classes of the encodings that to_table accepts. A column with one of these encodings is supported when the type of its values is. Check a type against them with isinstance, or use is_deephaven_compatible.

SUPPORTED_ARROW_TYPES = [DataType(null), DataType(bool), DataType(int8), DataType(int16), DataType(int32), DataType(int64), DataType(uint8), DataType(uint16), DataType(uint32), DataType(uint64), DataType(halffloat), DataType(float), DataType(double), Time32Type(time32[s]), Time32Type(time32[ms]), Time64Type(time64[us]), Time64Type(time64[ns]), TimestampType(timestamp[s]), TimestampType(timestamp[ms]), TimestampType(timestamp[us]), TimestampType(timestamp[ns]), DataType(date32[day]), DataType(date64[ms]), DurationType(duration[s]), DurationType(duration[ms]), DurationType(duration[us]), DurationType(duration[ns]), DataType(month_day_nano_interval), DataType(binary), DataType(string)]

The pyarrow data types that to_table maps directly to a Deephaven type. Parameterized types, such as decimals and lists, aren’t listed. Use is_deephaven_compatible to check any type.

is_deephaven_compatible(data_type)[source]

Checks whether to_table supports a pyarrow data type.

Parameters:

data_type (DataType) – the pyarrow data type

Return type:

bool

Returns:

True if to_table supports the type, False otherwise

read_feather(path)[source]

Reads an Arrow feather file into a Deephaven table.

Parameters:

path (str) – the file path

Return type:

Table

Returns:

a new table

Raises:

DHError –

to_arrow(table, cols=None)[source]

Creates a pyarrow table from a Deephaven table.

Parameters:
  • table (Table) – the Deephaven table

  • cols (Sequence[str] | None) – the table column names, default is None which means including all columns

Return type:

Table

Returns:

a pyarrow table

Raises:

DHError –

to_table(pa_table, cols=None)[source]

Creates a Deephaven table from a pyarrow table.

A column with an encoding in SUPPORTED_ARROW_ENCODINGS, such as a dictionary-encoded column, is supported when the type of its values is.

Parameters:
  • pa_table (Table) – the pyarrow table

  • cols (Sequence[str] | None) – the pyarrow table column names, default is None which means including all columns

Return type:

Table

Returns:

a new table

Raises:

DHError –