| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.dataset.Expression.html | [Back] [Original] |
Bases: _Weakrefable
A logical expression to be evaluated against some input.
To create an expression:
Use the factory function pyarrow.compute.scalar() to create a
scalar (not necessary when combined, see example below).
Use the factory function pyarrow.compute.field() to reference
a field (column in table).
Compare fields and scalars with <, <=, ==, >=, >.
Combine expressions using python operators & (logical and),
| (logical or) and ~ (logical not).
Note: python keywords and, or and not cannot be used
to combine expressions.
Create expression predicates using Expression methods such as
pyarrow.compute.Expression.isin().
Examples
>>> import pyarrow.compute as pc
>>> (pc.field("a") < pc.scalar(3)) | (pc.field("b") > 7)
<pyarrow.compute.Expression ((a < 3) or (b > 7))>
>>> pc.field('a') != 3
<pyarrow.compute.Expression (a != 3)>
>>> pc.field('a').isin([1, 2, 3])
<pyarrow.compute.Expression is_in(a, {value_set=int64:[
1,
2,
3
], null_matching_behavior=MATCH})>
Methods
|
|
|
Explicitly set or change the expression's data type. |
|
|
|
Deserialize an expression from Substrait |
|
Check whether the expression is NaN. |
|
Check whether the expression is null. |
|
Check whether the expression is not-null (valid). |
|
Check whether the expression is contained in values. |
|
Serialize the expression using Substrait |
Explicitly set or change the expressions data type.
This creates a new expression equivalent to calling the cast compute function on this expression.
ExpressionDeserialize an expression from Substrait
The serialized message must be an ExtendedExpression message that has only a single expression. The name of the expression and the schema the expression was bound to will be ignored. Use pyarrow.substrait.deserialize_expressions if this information is needed or if the message might contain multiple expressions.
bytes or Buffer or a protobuf MessageThe Substrait message to deserialize
ExpressionThe deserialized expression
Check whether the expression is NaN.
This creates a new expression equivalent to calling the is_nan compute function on this expression.
ExpressionCheck whether the expression is null.
This creates a new expression equivalent to calling the is_null compute function on this expression.
ExpressionCheck whether the expression is not-null (valid).
This creates a new expression equivalent to calling the is_valid compute function on this expression.
ExpressionCheck whether the expression is contained in values.
This creates a new expression equivalent to calling the is_in compute function on this expression.
ExpressionA new expression that, when evaluated, checks whether this expressions value is contained in values.
Serialize the expression using Substrait
The expression will be serialized as an ExtendedExpression message that has a single expression named expression
SchemaThe input schema the expression will be bound to
FalseIf 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 but the result may not be accepted by other compute libraries.
BufferA buffer containing the serialized Protobuf plan.
| Web Proxy Viewer | New URL | Original Page |