Skip to content
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
2 changes: 1 addition & 1 deletion datafusion/core/benches/sql_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn plan(ctx: Arc<Mutex<SessionContext>>, sql: &str) {
/// Create schema representing a large table
pub fn create_schema(column_prefix: &str) -> Schema {
let fields = (0..200)
.map(|i| Field::new(&format!("{}{}", column_prefix, i), DataType::Int32, true))
.map(|i| Field::new(format!("{}{}", column_prefix, i), DataType::Int32, true))
.collect();
Schema::new(fields)
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/avro_to_arrow/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn schema_to_field_with_props(
}
AvroSchema::Enum { symbols, name, .. } => {
return Ok(Field::new_dict(
&name.fullname(None),
name.fullname(None),
index_type(symbols.len()),
false,
0,
Expand Down
11 changes: 4 additions & 7 deletions datafusion/core/src/physical_plan/file_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,17 +523,14 @@ impl From<ObjectMeta> for FileMeta {
pub(crate) fn get_output_ordering(
base_config: &FileScanConfig,
) -> Option<&[PhysicalSortExpr]> {
if let Some(output_ordering) = base_config.output_ordering.as_ref() {
if base_config.file_groups.iter().any(|group| group.len() > 1) {
base_config.output_ordering.as_ref()
.map(|output_ordering| if base_config.file_groups.iter().any(|group| group.len() > 1) {
debug!("Skipping specified output ordering {:?}. Some file group had more than one file: {:?}",
output_ordering, base_config.file_groups);
None
} else {
Some(output_ordering)
}
} else {
None
}
Some(output_ordering.as_slice())
}).unwrap_or_else(|| None)
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_plan/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl AggregateExpr for AggregateFunctionExpr {
.enumerate()
.map(|(i, data_type)| {
Field::new(
&format_state_name(&self.name, &format!("{}", i)),
format_state_name(&self.name, &format!("{}", i)),
data_type.clone(),
true,
)
Expand Down
2 changes: 1 addition & 1 deletion datafusion/expr/src/field_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use datafusion_common::{DataFusionError, Result, ScalarValue};
pub fn get_indexed_field(data_type: &DataType, key: &ScalarValue) -> Result<Field> {
match (data_type, key) {
(DataType::List(lt), ScalarValue::Int64(Some(i))) => {
Ok(Field::new(&i.to_string(), lt.data_type().clone(), true))
Ok(Field::new(i.to_string(), lt.data_type().clone(), true))
}
(DataType::Struct(fields), ScalarValue::Utf8(Some(s))) => {
if s.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/optimizer/src/push_down_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ impl OptimizerRule for PushDownFilter {
let group_expr_columns = agg
.group_expr
.iter()
.map(|e| Ok(Column::from_qualified_name(&(e.display_name()?))))
.map(|e| Ok(Column::from_qualified_name(e.display_name()?)))
.collect::<Result<HashSet<_>>>()?;

let predicates = utils::split_conjunction_owned(utils::cnf_rewrite(
Expand Down
2 changes: 1 addition & 1 deletion datafusion/optimizer/src/single_distinct_to_groupby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl OptimizerRule for SingleDistinctToGroupBy {
let mut alias_expr: Vec<Expr> = Vec::new();
for (alias, original_field) in group_expr_alias {
alias_expr
.push(col(&alias).alias(original_field.qualified_name()));
.push(col(alias).alias(original_field.qualified_name()));
}
for (i, expr) in new_aggr_exprs.iter().enumerate() {
alias_expr.push(columnize_expr(
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/approx_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl AggregateExpr for ApproxDistinct {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "hll_registers"),
format_state_name(&self.name, "hll_registers"),
DataType::Binary,
false,
)])
Expand Down
12 changes: 6 additions & 6 deletions datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,32 +188,32 @@ impl AggregateExpr for ApproxPercentileCont {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "max_size"),
format_state_name(&self.name, "max_size"),
DataType::UInt64,
false,
),
Field::new(
&format_state_name(&self.name, "sum"),
format_state_name(&self.name, "sum"),
DataType::Float64,
false,
),
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::Float64,
false,
),
Field::new(
&format_state_name(&self.name, "max"),
format_state_name(&self.name, "max"),
DataType::Float64,
false,
),
Field::new(
&format_state_name(&self.name, "min"),
format_state_name(&self.name, "min"),
DataType::Float64,
false,
),
Field::new(
&format_state_name(&self.name, "centroids"),
format_state_name(&self.name, "centroids"),
DataType::List(Box::new(Field::new("item", DataType::Float64, true))),
false,
),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/array_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl AggregateExpr for ArrayAgg {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "array_agg"),
format_state_name(&self.name, "array_agg"),
DataType::List(Box::new(Field::new(
"item",
self.input_data_type.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl AggregateExpr for DistinctArrayAgg {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "distinct_array_agg"),
format_state_name(&self.name, "distinct_array_agg"),
DataType::List(Box::new(Field::new(
"item",
self.input_data_type.clone(),
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/aggregate/average.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ impl AggregateExpr for Avg {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
true,
),
Field::new(
&format_state_name(&self.name, "sum"),
format_state_name(&self.name, "sum"),
self.data_type.clone(),
true,
),
Expand Down
12 changes: 6 additions & 6 deletions datafusion/physical-expr/src/aggregate/correlation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,32 @@ impl AggregateExpr for Correlation {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
true,
),
Field::new(
&format_state_name(&self.name, "mean1"),
format_state_name(&self.name, "mean1"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "m2_1"),
format_state_name(&self.name, "m2_1"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "mean2"),
format_state_name(&self.name, "mean2"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "m2_2"),
format_state_name(&self.name, "m2_2"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "algo_const"),
format_state_name(&self.name, "algo_const"),
DataType::Float64,
true,
),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl AggregateExpr for Count {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
self.data_type.clone(),
true,
)])
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/count_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl AggregateExpr for DistinctCount {
.iter()
.map(|state_data_type| {
Field::new(
&format_state_name(&self.name, "count distinct"),
format_state_name(&self.name, "count distinct"),
DataType::List(Box::new(Field::new(
"item",
state_data_type.clone(),
Expand Down
16 changes: 8 additions & 8 deletions datafusion/physical-expr/src/aggregate/covariance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@ impl AggregateExpr for Covariance {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
true,
),
Field::new(
&format_state_name(&self.name, "mean1"),
format_state_name(&self.name, "mean1"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "mean2"),
format_state_name(&self.name, "mean2"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "algo_const"),
format_state_name(&self.name, "algo_const"),
DataType::Float64,
true,
),
Expand Down Expand Up @@ -154,22 +154,22 @@ impl AggregateExpr for CovariancePop {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
true,
),
Field::new(
&format_state_name(&self.name, "mean1"),
format_state_name(&self.name, "mean1"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "mean2"),
format_state_name(&self.name, "mean2"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "algo_const"),
format_state_name(&self.name, "algo_const"),
DataType::Float64,
true,
),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/grouping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl AggregateExpr for Grouping {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "grouping"),
format_state_name(&self.name, "grouping"),
self.data_type.clone(),
true,
)])
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/median.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl AggregateExpr for Median {
let data_type = DataType::List(Box::new(field));

Ok(vec![Field::new(
&format_state_name(&self.name, "median"),
format_state_name(&self.name, "median"),
data_type,
true,
)])
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/aggregate/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl AggregateExpr for Max {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "max"),
format_state_name(&self.name, "max"),
self.data_type.clone(),
true,
)])
Expand Down Expand Up @@ -664,7 +664,7 @@ impl AggregateExpr for Min {

fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![Field::new(
&format_state_name(&self.name, "min"),
format_state_name(&self.name, "min"),
self.data_type.clone(),
true,
)])
Expand Down
20 changes: 6 additions & 14 deletions datafusion/physical-expr/src/aggregate/stddev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,16 @@ impl AggregateExpr for Stddev {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
true,
),
Field::new(
&format_state_name(&self.name, "mean"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "m2"),
format_state_name(&self.name, "mean"),
DataType::Float64,
true,
),
Field::new(format_state_name(&self.name, "m2"), DataType::Float64, true),
])
}

Expand Down Expand Up @@ -135,20 +131,16 @@ impl AggregateExpr for StddevPop {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
true,
),
Field::new(
&format_state_name(&self.name, "mean"),
DataType::Float64,
true,
),
Field::new(
&format_state_name(&self.name, "m2"),
format_state_name(&self.name, "mean"),
DataType::Float64,
true,
),
Field::new(format_state_name(&self.name, "m2"), DataType::Float64, true),
])
}

Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/aggregate/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ impl AggregateExpr for Sum {
fn state_fields(&self) -> Result<Vec<Field>> {
Ok(vec![
Field::new(
&format_state_name(&self.name, "sum"),
format_state_name(&self.name, "sum"),
self.data_type.clone(),
self.nullable,
),
Field::new(
&format_state_name(&self.name, "count"),
format_state_name(&self.name, "count"),
DataType::UInt64,
self.nullable,
),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/aggregate/sum_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl AggregateExpr for DistinctSum {
fn state_fields(&self) -> Result<Vec<Field>> {
// State field is a List which stores items to rebuild hash set.
Ok(vec![Field::new(
&format_state_name(&self.name, "sum distinct"),
format_state_name(&self.name, "sum distinct"),
DataType::List(Box::new(Field::new("item", self.data_type.clone(), true))),
false,
)])
Expand Down
Loading