graviti.dataframe.sql.operator#

The search operators for type inference.

Module Contents#

Classes#

OperatorRegister

The class decorator to connect operator name and operator function.

Functions#

infer_type(schema, expr)

Infer portex type from the Graviti criteria expr.

get_type(schema, expr)

Get portex type from the Graviti criteria expr.

Attributes#

graviti.dataframe.sql.operator.PYTHON_TYPE_TO_PORTEX_TYPE[source]#
graviti.dataframe.sql.operator.OPERATORS :Dict[str, _Operator][source]#
class graviti.dataframe.sql.operator.OperatorRegister(*names)[source]#

The class decorator to connect operator name and operator function.

Parameters
  • name – The name of the operator.

  • names (str) –

graviti.dataframe.sql.operator.infer_type(schema, expr)[source]#

Infer portex type from the Graviti criteria expr.

Parameters
  • schema (graviti.portex.PortexRecordBase) – The schema of the sheet.

  • expr (_Expr) – The Graviti criteria expr.

Returns

The result portex type inferred from the expr.

Raises

CriteriaError – When the operator is not supported.

Return type

graviti.portex.PortexType

graviti.dataframe.sql.operator.get_type(schema, expr)[source]#

Get portex type from the Graviti criteria expr.

Parameters
  • schema (graviti.portex.PortexRecordBase) – The schema of the sheet.

  • expr (str) – The Graviti criteria expr.

Returns

The result portex type inferred from the expr.

Raises

CriteriaError – When the portex type cannot be get from the expr.

Return type

graviti.portex.PortexType