pub struct TableValuedFunction { /* private fields */ }Expand description
Table-valued functions for Spark SQL.
Mirrors pyspark.sql.connect.tvf.TableValuedFunction.
Implementations§
Source§impl TableValuedFunction
impl TableValuedFunction
Sourcepub fn udtf(
&self,
name: &str,
arguments: Vec<Column>,
return_type: Option<DataType>,
eval_type: i32,
command: Vec<u8>,
python_ver: String,
deterministic: bool,
) -> DataFrame
pub fn udtf( &self, name: &str, arguments: Vec<Column>, return_type: Option<DataType>, eval_type: i32, command: Vec<u8>, python_ver: String, deterministic: bool, ) -> DataFrame
Invoke a Python user-defined table function (UDTF), returning its output
as a DataFrame. Mirrors pyspark.sql.functions.udtf. The Python side
cloudpickles the handler and sets eval_type (300 SQL_TABLE_UDF,
301 SQL_ARROW_TABLE_UDF, 302 SQL_ARROW_UDTF); command is the pickled payload.
Sourcepub fn range(
&self,
start: i64,
end: Option<i64>,
step: i64,
num_partitions: Option<i32>,
) -> Result<DataFrame>
pub fn range( &self, start: i64, end: Option<i64>, step: i64, num_partitions: Option<i32>, ) -> Result<DataFrame>
Create a DataFrame representing a range of integers.
This is a table-valued function that generates a sequence of integers
from start to end with the given step.
§Arguments
start- Starting value (inclusive)end- Ending value (exclusive) or the only value if called with one argumentstep- Step size between values (default 1)num_partitions- Number of partitions (optional)
§Example
let df = spark.tvf().range(0, 100, 1, None)?;Sourcepub fn explode_outer(&self, collection: &Column) -> Result<DataFrame>
pub fn explode_outer(&self, collection: &Column) -> Result<DataFrame>
Explode an array or map column, preserving nulls as empty rows.
Similar to explode, but null values are preserved.
Sourcepub fn inline_outer(&self, input: &Column) -> Result<DataFrame>
pub fn inline_outer(&self, input: &Column) -> Result<DataFrame>
Inline an array of structs column, preserving nulls as empty rows.
Similar to inline, but null values are preserved.
Sourcepub fn json_tuple<C: Into<Column>>(
&self,
input: &Column,
fields: impl IntoIterator<Item = C>,
) -> Result<DataFrame>
pub fn json_tuple<C: Into<Column>>( &self, input: &Column, fields: impl IntoIterator<Item = C>, ) -> Result<DataFrame>
Sourcepub fn posexplode(&self, collection: &Column) -> Result<DataFrame>
pub fn posexplode(&self, collection: &Column) -> Result<DataFrame>
Explode an array column with position indices.
Similar to explode, but also includes the position of each element.
Sourcepub fn posexplode_outer(&self, collection: &Column) -> Result<DataFrame>
pub fn posexplode_outer(&self, collection: &Column) -> Result<DataFrame>
Explode an array column with position indices, preserving nulls.
Similar to posexplode, but null values are preserved.
Sourcepub fn stack<C: Into<Column>>(
&self,
n: &Column,
fields: impl IntoIterator<Item = C>,
) -> Result<DataFrame>
pub fn stack<C: Into<Column>>( &self, n: &Column, fields: impl IntoIterator<Item = C>, ) -> Result<DataFrame>
Stack function.
Converts multiple columns into rows.
§Arguments
n- The number of columns to stackfields- The columns to stack
Sourcepub fn collations(&self) -> Result<DataFrame>
pub fn collations(&self) -> Result<DataFrame>
Returns a DataFrame of collation names.
Sourcepub fn sql_keywords(&self) -> Result<DataFrame>
pub fn sql_keywords(&self) -> Result<DataFrame>
Returns a DataFrame of SQL keywords.
Sourcepub fn variant_explode(&self, input: &Column) -> Result<DataFrame>
pub fn variant_explode(&self, input: &Column) -> Result<DataFrame>
Explode a variant column.
Variant columns contain semi-structured data in Spark SQL.
Sourcepub fn variant_explode_outer(&self, input: &Column) -> Result<DataFrame>
pub fn variant_explode_outer(&self, input: &Column) -> Result<DataFrame>
Explode a variant column, preserving nulls.
Sourcepub fn python_worker_logs(&self) -> Result<DataFrame>
pub fn python_worker_logs(&self) -> Result<DataFrame>
Get Python worker logs as a DataFrame.
Auto Trait Implementations§
impl !RefUnwindSafe for TableValuedFunction
impl !UnwindSafe for TableValuedFunction
impl Freeze for TableValuedFunction
impl Send for TableValuedFunction
impl Sync for TableValuedFunction
impl Unpin for TableValuedFunction
impl UnsafeUnpin for TableValuedFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request