Skip to content

Commit

Permalink
Tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasrepo committed Apr 26, 2024
1 parent e8dac2e commit b316885
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions datafusion/core/src/physical_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,7 @@ pub fn create_aggregate_expr_and_maybe_filter(
Expr::Alias(Alias { expr, name, .. }) => (name.clone(), expr.as_ref()),
_ => (physical_name(e)?, e),
};

create_aggregate_expr_with_name_and_maybe_filter(
e,
name,
Expand Down
1 change: 1 addition & 0 deletions datafusion/physical-expr-common/src/aggregate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub fn create_aggregate_expr(
}))
}

#[allow(dead_code)]
fn calc_fn_name_with_args(fn_name: &str, args: &[Arc<dyn PhysicalExpr>]) -> String {
let args = args
.iter()
Expand Down
10 changes: 5 additions & 5 deletions datafusion/physical-expr/src/equivalence/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::sync::Arc;
use arrow::datatypes::SchemaRef;

use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
use datafusion_common::{internal_err, Result};
use datafusion_common::{Result};

use crate::expressions::Column;
use crate::PhysicalExpr;
Expand Down Expand Up @@ -67,10 +67,10 @@ impl ProjectionMapping {
// Conceptually, `source_expr` and `expression` should be the same.
let idx = col.index();
let matching_input_field = input_schema.field(idx);
if col.name() != matching_input_field.name() {
return internal_err!("Input field name {} does not match with the projection expression {}",
matching_input_field.name(),col.name())
}
// if col.name() != matching_input_field.name() {
// return internal_err!("Input field name {} does not match with the projection expression {}",
// matching_input_field.name(),col.name())
// }
let matching_input_column =
Column::new(matching_input_field.name(), idx);
Ok(Transformed::yes(Arc::new(matching_input_column)))
Expand Down
5 changes: 3 additions & 2 deletions datafusion/sqllogictest/test_files/distinct_on.slt
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ logical_plan
physical_plan
01)SortPreservingMergeExec: [aggregate_test_100.c2 % Int64(2) = Int64(0)@0 ASC NULLS LAST]
02)--SortExec: expr=[aggregate_test_100.c2 % Int64(2) = Int64(0)@0 ASC NULLS LAST]
03)----AggregateExec: mode=FinalPartitioned, gby=[aggregate_test_100.c2 % Int64(2) = Int64(0)@0 as aggregate_test_100.c2 % Int64(2) = Int64(0)], aggr=[FIRST_VALUE(aggregate_test_100.c3 - Int64(100)) ORDER BY [c3@1 DESC]]
03)----AggregateExec: mode=FinalPartitioned, gby=[aggregate_test_100.c2 % Int64(2) = Int64(0)@0 as aggregate_test_100.c2 % Int64(2) = Int64(0)], aggr=[FIRST_VALUE(aggregate_test_100.c3 - Int64(100)) ORDER BY [aggregate_test_100.c3 DESC NULLS FIRST]]
04)------CoalesceBatchesExec: target_batch_size=8192
05)--------RepartitionExec: partitioning=Hash([aggregate_test_100.c2 % Int64(2) = Int64(0)@0], 4), input_partitions=4
06)----------AggregateExec: mode=Partial, gby=[CAST(c2@0 AS Int64) % 2 = 0 as aggregate_test_100.c2 % Int64(2) = Int64(0)], aggr=[FIRST_VALUE(CAST(c3@1 AS Int64) - 100) ORDER BY [c3@1 DESC]]
06)----------AggregateExec: mode=Partial, gby=[CAST(c2@0 AS Int64) % 2 = 0 as aggregate_test_100.c2 % Int64(2) = Int64(0)], aggr=[FIRST_VALUE(aggregate_test_100.c3 - Int64(100)) ORDER BY [aggregate_test_100.c3 DESC NULLS FIRST]]
07)------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
08)--------------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c2, c3], has_header=true


query BI
SELECT c2 % 2 = 0, FIRST_VALUE(c3-100 ORDER BY c3 DESC)
FROM aggregate_test_100
Expand Down

0 comments on commit b316885

Please sign in to comment.