pyarrow.substrait.serialize_expressions#

pyarrow.substrait.serialize_expressions(exprs, names, schema, *, allow_arrow_extensions=False)#

Serialize a collection of expressions into Substrait

Substrait expressions must be bound to a schema. For example, the Substrait expression a:i32 + b:i32 is different from the Substrait expression a:i64 + b:i64. Pyarrow expressions are typically unbound. For example, both of the above expressions would be represented as a + b in pyarrow.

This means a schema must be provided when serializing an expression. It also means that the serialization may fail if a matching function call cannot be found for the expression.

Parameters:
exprslist of Expression

The expressions to serialize

nameslist of str

Names for the expressions

schemaSchema

The schema the expressions will be bound to

allow_arrow_extensionsbool, default False

If False then only functions that are part of the core Substrait function definitions will be allowed. Set this to True to allow pyarrow-specific functions and user defined functions but the result may not be accepted by other compute libraries.

Returns:
Buffer

An ExtendedExpression message containing the serialized expressions