graviti.paging.wrapper#

PyArrow array wrapper related class.

Module Contents#

Classes#

WrapperRegister

The class decorator to connect pyarrow type and the pyarrow array wrapper.

ScalarWrapper

The wrapper of pyarrow scalar.

ArrayWrapper

The wrapper of pyarrow array.

StructScalarWrapper

The wrapper of pyarrow StructScalar to make it case insensitive.

StructArrayWrapper

The wrapper of pyarrow StructArray to make it case insensitive.

ListScalarWrapper

The wrapper of pyarrow ListScalar to make it case insensitive.

ListArrayWrapper

The wrapper of pyarrow ListArray to make it case insensitive.

class graviti.paging.wrapper.WrapperRegister(pyarrow_type_id)[source]#

The class decorator to connect pyarrow type and the pyarrow array wrapper.

Parameters

pyarrow_type_id (int) – The PyArrow type id.

classmethod get(cls, pyarrow_type_id)[source]#

Get the corresponding registered pyarrow array wrapper.

Parameters

pyarrow_type_id (int) – The PyArrow type id.

Returns

The corresponding registered pyarrow array wrapper.

Return type

Type[ArrayWrapper]

class graviti.paging.wrapper.ScalarWrapper(scalar)[source]#

The wrapper of pyarrow scalar.

Parameters

scalar (pyarrow.scalar) – The PyArrow scalar needs to be wrapped.

property is_valid(self)[source]#

The wrapper of pyarrow Scalar.is_valid method.

Returns

Bool value indicating whether this scalar is None.

Return type

bool

as_py(self)[source]#

The wrapper of pyarrow Scalar.as_py method.

Returns

Return this value as a Python builtin object.

Return type

Any

class graviti.paging.wrapper.ArrayWrapper(array)[source]#

The wrapper of pyarrow array.

Parameters

array (pyarrow.Array) – The PyArrow array needs to be wrapped.

class graviti.paging.wrapper.StructScalarWrapper(scalar)[source]#

Bases: ScalarWrapper

The wrapper of pyarrow StructScalar to make it case insensitive.

Parameters

scalar (pyarrow.StructScalar) – The PyArrow StructScalar needs to be wrapped.

classmethod from_wrapper(cls, scalar, wrappers)[source]#

Create StructScalarWrapper instance by inputing scalar and wrappers.

Parameters
  • scalar (pyarrow.ListScalar) – The PyArrow StructScalar needs to be wrapped.

  • wrappers (Dict[str, Type[ArrayWrapper]]) – The wrappers of the input scalar.

  • cls (Type[_S]) –

Returns

The StructScalarWrapper instance created by the input scalar and wrapper.

Return type

_S

class graviti.paging.wrapper.StructArrayWrapper(array)[source]#

Bases: ArrayWrapper

The wrapper of pyarrow StructArray to make it case insensitive.

Parameters

array (pyarrow.StringArray) – The PyArrow StructArray instance needs to be wrapped.

field(self, key)[source]#

The wrapper of pyarrow StructArray.field method.

Parameters

key (str) – The name of the field.

Returns

The child array belonging to the field.

Return type

pyarrow.Array

class graviti.paging.wrapper.ListScalarWrapper(scalar)[source]#

Bases: ScalarWrapper

The wrapper of pyarrow ListScalar to make it case insensitive.

Parameters

scalar (pyarrow.ListScalar) – The PyArrow ListScalar instance needs to be wrapped.

classmethod from_wrapper(cls, scalar, wrapper)[source]#

Create ListScalarWrapper instance by inputing scalar and wrapper.

Parameters
  • scalar (pyarrow.ListScalar) – The PyArrow ListScalar instance needs to be wrapped.

  • wrapper (Type[ArrayWrapper]) – The wrapper of the input scalar.

  • cls (Type[_LS]) –

Returns

The ListScalarWrapper instance created by the input scalar and wrapper.

Return type

_LS

property values(self)[source]#

The wrapper of pyarrow ListScalar.values attr.

Returns

The internal values of the pyarrow scalar.

Return type

ArrayWrapper

class graviti.paging.wrapper.ListArrayWrapper(array)[source]#

Bases: ArrayWrapper

The wrapper of pyarrow ListArray to make it case insensitive.

Parameters

array (pyarrow.ListArray) – The PyArrow ListScalar instance needs to be wrapped.

classmethod from_wrapper(cls, array, wrapper)[source]#

Create ListScalarWrapper instance by inputing scalar and wrapper.

Parameters
  • array (pyarrow.ListArray) – The PyArrow ListArray instance needs to be wrapped.

  • wrapper (Type[ArrayWrapper]) – The wrapper of the input array.

  • cls (Type[_LA]) –

Returns

The ListScalarWrapper instance created by the input scalar and wrapper.

Return type

_LA