Struct datafusion_python::expr::PyExpr

source ·
pub struct PyExpr {
    pub expr: Expr,
}
Expand description

A PyExpr that can be used on a DataFrame

Fields§

§expr: Expr

Implementations§

source§

impl PyExpr

source

pub fn literal(value: ScalarValue) -> PyExpr

source

pub fn column(value: &str) -> PyExpr

source

pub fn alias(&self, name: &str) -> PyExpr

assign a name to the PyExpr

source

pub fn sort(&self, ascending: bool, nulls_first: bool) -> PyExpr

Create a sort PyExpr from an existing PyExpr.

source

pub fn is_null(&self) -> PyExpr

source

pub fn cast(&self, to: PyArrowType<DataType>) -> PyExpr

source

pub fn rex_type(&self) -> PyResult<RexType>

A Rex (Row Expression) specifies a single row of data. That specification could include user defined functions or types. RexType identifies the row as one of the possible valid RexTypes.

source

pub fn types(&self) -> PyResult<DataTypeMap>

Given the current Expr return the DataTypeMap which represents the PythonType, Arrow DataType, and SqlType Enum which represents

source

pub fn python_value(&self, py: Python<'_>) -> PyResult<PyObject>

Extracts the Expr value into a PyObject that can be shared with Python

source

pub fn rex_call_operands(&self) -> PyResult<Vec<PyExpr>>

Row expressions, Rex(s), operate on the concept of operands. Different variants of Expressions, Expr(s), store those operands in different datastructures. This function examines the Expr variant and returns the operands to the calling logic as a Vec of PyExpr instances.

source

pub fn rex_call_operator(&self) -> PyResult<String>

Extracts the operator associated with a RexType::Call

source

pub fn column_name(&self, plan: PyLogicalPlan) -> PyResult<String>

source§

impl PyExpr

source

pub fn _column_name( &self, plan: &LogicalPlan, ) -> Result<String, DataFusionError>

source

pub fn expr_to_field( expr: &Expr, input_plan: &LogicalPlan, ) -> Result<Arc<Field>, DataFusionError>

Create a Field representing an Expr, given an input LogicalPlan to resolve against

Trait Implementations§

source§

impl Clone for PyExpr

source§

fn clone(&self) -> PyExpr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PyExpr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Expr> for PyExpr

source§

fn from(expr: Expr) -> PyExpr

Converts to this type from the input type.
source§

impl From<PyExpr> for Expr

source§

fn from(expr: PyExpr) -> Expr

Converts to this type from the input type.
source§

impl HasPyGilRef for PyExpr

§

type AsRefTarget = PyCell<PyExpr>

Utility type to make Py::as_ref work.
source§

impl IntoPy<Py<PyAny>> for PyExpr

source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
source§

impl PyClass for PyExpr

§

type Frozen = False

Whether the pyclass is frozen. Read more
source§

impl PyClassImpl for PyExpr

source§

const IS_BASETYPE: bool = true

#[pyclass(subclass)]
source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
§

type BaseType = PyAny

Base class
§

type ThreadChecker = SendablePyClass<PyExpr>

This handles following two situations: Read more
§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
source§

fn items_iter() -> PyClassItemsIter

source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

source§

fn dict_offset() -> Option<isize>

source§

fn weaklist_offset() -> Option<isize>

source§

impl PyClass__add__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __add__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl PyClass__and__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __and__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl PyClass__mod__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __mod__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl PyClass__mul__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __mul__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl PyClass__or__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __or__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl PyClass__sub__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __sub__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl PyClass__truediv__SlotFragment<PyExpr> for PyClassImplCollector<PyExpr>

source§

unsafe fn __truediv__( self, py: Python<'_>, _raw_slf: *mut PyObject, arg0: *mut PyObject, ) -> PyResult<*mut PyObject>

Safety: _slf and _other must be valid non-null Python objects Read more
source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyExpr

§

type Holder = Option<PyRef<'py, PyExpr>>

source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyExpr

§

type Holder = Option<PyRefMut<'py, PyExpr>>

source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

source§

impl PyMethods<PyExpr> for PyClassImplCollector<PyExpr>

source§

fn py_methods(self) -> &'static PyClassItems

source§

impl PyTypeInfo for PyExpr

source§

const NAME: &'static str = "Expr"

Class name.
source§

const MODULE: Option<&'static str> = _

Module name, if any.
source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
source§

fn type_object(py: Python<'_>) -> &PyType

👎Deprecated since 0.21.0: PyTypeInfo::type_object will be replaced by PyTypeInfo::type_object_bound in a future PyO3 version
Returns the safe abstraction over the type object.
source§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
source§

fn is_type_of(object: &PyAny) -> bool

👎Deprecated since 0.21.0: PyTypeInfo::is_type_of will be replaced by PyTypeInfo::is_type_of_bound in a future PyO3 version
Checks if object is an instance of this type or a subclass of this type.
source§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
source§

fn is_exact_type_of(object: &PyAny) -> bool

👎Deprecated since 0.21.0: PyTypeInfo::is_exact_type_of will be replaced by PyTypeInfo::is_exact_type_of_bound in a future PyO3 version
Checks if object is an instance of this type.
source§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
source§

impl DerefToPyAny for PyExpr

Auto Trait Implementations§

§

impl Freeze for PyExpr

§

impl !RefUnwindSafe for PyExpr

§

impl Send for PyExpr

§

impl Sync for PyExpr

§

impl Unpin for PyExpr

§

impl !UnwindSafe for PyExpr

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromPyObject<'_> for T
where T: PyClass + Clone,

source§

fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
source§

fn extract(ob: &'py PyAny) -> Result<Self, PyErr>

Extracts Self from the source GIL Ref obj. Read more
source§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

source§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
source§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

source§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
source§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Ungil for T
where T: Send,