graviti.dataframe.sql.array#

The implementation of the search related array.

Module Contents#

Classes#

LogicalOperatorsMixin

A mixin for dynamically implementing logical operators.

ScalarArray

One-dimensional array for portex builtin type array.

BooleanScalarArray

One-dimensional array for portex builtin type array with the boolean items.

StringScalarArray

One-dimensional array for portex builtin type array with the string and enum items.

EnumScalarArray

One-dimensional array for portex builtin type array with the string and enum items.

NumberScalarArray

One-dimensional array for portex builtin type array with the numerical items.

DataFrame

The Two-dimensional array for the search.

ArrayDistributor

A distributor to instance DataFrame, ArrayScalar by different array items.

ArraySeries

The One-dimensional array for the search.

class graviti.dataframe.sql.array.LogicalOperatorsMixin[source]#

A mixin for dynamically implementing logical operators.

class graviti.dataframe.sql.array.ScalarArray(expr, schema, upper_expr)[source]#

Bases: graviti.dataframe.sql.container.SearchContainer

One-dimensional array for portex builtin type array.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

query(self, func)[source]#

Query the data of an ArraySeries with a lambda function.

Parameters

func (Callable[[Any], Any]) – The query function.

Returns

The ArraySeries with the query expression.

Return type

ScalarArray

any(self)[source]#

Whether any element is True.

Returns

The BooleanSeries with the any expression.

Return type

graviti.dataframe.sql.scalar.BooleanScalar

all(self)[source]#

Whether all elements are True.

Returns

The BooleanSeries with the all expression.

Return type

graviti.dataframe.sql.scalar.BooleanScalar

class graviti.dataframe.sql.array.BooleanScalarArray(expr, schema, upper_expr)[source]#

Bases: ScalarArray, LogicalOperatorsMixin

One-dimensional array for portex builtin type array with the boolean items.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

class graviti.dataframe.sql.array.StringScalarArray(expr, schema, upper_expr)[source]#

Bases: ScalarArray, LogicalOperatorsMixin

One-dimensional array for portex builtin type array with the string and enum items.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

class graviti.dataframe.sql.array.EnumScalarArray(expr, schema, upper_expr)[source]#

Bases: ScalarArray

One-dimensional array for portex builtin type array with the string and enum items.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

class graviti.dataframe.sql.array.NumberScalarArray(expr, schema, upper_expr)[source]#

Bases: ScalarArray, graviti.dataframe.sql.scalar.ComparisonArithmeticOperatorsMixin

One-dimensional array for portex builtin type array with the numerical items.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

size(self)[source]#

Get the length of array series.

Returns

The NumberScalar with the size expression.

Return type

graviti.dataframe.sql.scalar.NumberScalar

max(self)[source]#

Get the max value of array series.

Returns

The NumberScalar with the max expression.

Return type

graviti.dataframe.sql.scalar.NumberScalar

min(self)[source]#

Get the min value of array series.

Returns

The NumberScalar with the min expression.

Return type

graviti.dataframe.sql.scalar.NumberScalar

sum(self)[source]#

Get the sum of array series.

Returns

The NumberScalar with the sum expression.

Return type

graviti.dataframe.sql.scalar.NumberScalar

class graviti.dataframe.sql.array.DataFrame(expr, schema, upper_expr)[source]#

Bases: graviti.dataframe.sql.container.SearchContainer

The Two-dimensional array for the search.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

query(self, func)[source]#

Query the data of an ArraySeries with a lambda function.

Parameters

func (Callable[[Any], Any]) – The query function.

Returns

The DataFrame with the query expression.

Return type

DataFrame

class graviti.dataframe.sql.array.ArrayDistributor(expr, schema, upper_expr)[source]#

Bases: graviti.dataframe.sql.container.SearchContainer

A distributor to instance DataFrame, ArrayScalar by different array items.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –

classmethod from_upper(cls, expr, schema)[source]#

Instantiate a Search object from the upper level.

Parameters
  • expr (Union[str, Dict[str, Any]]) – The expression of the search.

  • schema (graviti.portex.PortexType) – The schema of the series.

Returns

The loaded object.

Return type

graviti.dataframe.sql.container.SearchContainer

class graviti.dataframe.sql.array.ArraySeries(expr, schema, upper_expr)[source]#

Bases: graviti.dataframe.sql.container.SearchContainer

The One-dimensional array for the search.

Parameters
  • expr (_E) –

  • schema (graviti.portex.PortexType) –

  • upper_expr (_E) –