Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

apply cargo fmt #12

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ impl PyExecutionContext {
Ok(PyDataFrame::new(df))
}

fn create_dataframe(
&mut self,
partitions: Vec<Vec<RecordBatch>>,
) -> PyResult<PyDataFrame> {
fn create_dataframe(&mut self, partitions: Vec<Vec<RecordBatch>>) -> PyResult<PyDataFrame> {
let table = MemTable::try_new(partitions[0][0].schema(), partitions)
.map_err(DataFusionError::from)?;

Expand Down
21 changes: 8 additions & 13 deletions src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ use pyo3::{prelude::*, wrap_pyfunction};

use datafusion::logical_plan;

use datafusion::physical_plan::{
aggregates::AggregateFunction, functions::BuiltinScalarFunction,
};
use datafusion::physical_plan::{aggregates::AggregateFunction, functions::BuiltinScalarFunction};

use crate::errors;
use crate::expression::PyExpr;
Expand Down Expand Up @@ -88,11 +86,7 @@ fn concat_ws(sep: String, args: Vec<PyExpr>) -> PyResult<PyExpr> {

/// Creates a new Sort expression
#[pyfunction]
fn order_by(
expr: PyExpr,
asc: Option<bool>,
nulls_first: Option<bool>,
) -> PyResult<PyExpr> {
fn order_by(expr: PyExpr, asc: Option<bool>, nulls_first: Option<bool>) -> PyResult<PyExpr> {
Ok(PyExpr {
expr: datafusion::logical_plan::Expr::Sort {
expr: Box::new(expr.expr),
Expand All @@ -106,10 +100,7 @@ fn order_by(
#[pyfunction]
fn alias(expr: PyExpr, name: &str) -> PyResult<PyExpr> {
Ok(PyExpr {
expr: datafusion::logical_plan::Expr::Alias(
Box::new(expr.expr),
String::from(name),
),
expr: datafusion::logical_plan::Expr::Alias(Box::new(expr.expr), String::from(name)),
})
}

Expand Down Expand Up @@ -244,7 +235,11 @@ scalar_function!(sha384, SHA384);
scalar_function!(sha512, SHA512);
scalar_function!(signum, Signum);
scalar_function!(sin, Sin);
scalar_function!(split_part, SplitPart, "Splits string at occurrences of delimiter and returns the n'th field (counting from one).");
scalar_function!(
split_part,
SplitPart,
"Splits string at occurrences of delimiter and returns the n'th field (counting from one)."
);
scalar_function!(sqrt, Sqrt);
scalar_function!(
starts_with,
Expand Down
4 changes: 1 addition & 3 deletions src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ use datafusion::arrow::datatypes::DataType;
use datafusion::arrow::pyarrow::PyArrowConvert;
use datafusion::error::DataFusionError;
use datafusion::logical_plan;
use datafusion::physical_plan::functions::{
make_scalar_function, ScalarFunctionImplementation,
};
use datafusion::physical_plan::functions::{make_scalar_function, ScalarFunctionImplementation};
use datafusion::physical_plan::udf::ScalarUDF;

use crate::expression::PyExpr;
Expand Down