This is an automated email from the ASF dual-hosted git repository.
jayzhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 08e19f4956 Remove redundant upper case aliases for `median`,
`first_value` and `last_value` (#10696)
08e19f4956 is described below
commit 08e19f4956d32164be6fc66eb5a4c080eb0023d1
Author: Jax Liu <[email protected]>
AuthorDate: Wed May 29 13:08:14 2024 +0800
Remove redundant upper case aliases for `median`, `first_value` and
`last_value` (#10696)
* change udaf name to lowercase
* enhance test for duplicate function name
* fix test
* fix tests
* remove redundant alias field
---
datafusion/functions-aggregate/src/first_last.rs | 12 +-
datafusion/functions-aggregate/src/lib.rs | 4 +-
datafusion/functions-aggregate/src/median.rs | 6 +-
datafusion/functions-array/src/lib.rs | 4 +-
datafusion/functions/src/lib.rs | 4 +-
.../optimizer/src/replace_distinct_aggregate.rs | 4 +-
datafusion/sqllogictest/test_files/aggregate.slt | 22 +--
datafusion/sqllogictest/test_files/distinct_on.slt | 10 +-
datafusion/sqllogictest/test_files/group_by.slt | 162 ++++++++++-----------
datafusion/sqllogictest/test_files/joins.slt | 26 ++--
10 files changed, 124 insertions(+), 130 deletions(-)
diff --git a/datafusion/functions-aggregate/src/first_last.rs
b/datafusion/functions-aggregate/src/first_last.rs
index 6fcb655ae4..f1cb92045f 100644
--- a/datafusion/functions-aggregate/src/first_last.rs
+++ b/datafusion/functions-aggregate/src/first_last.rs
@@ -49,7 +49,6 @@ make_udaf_expr_and_func!(
pub struct FirstValue {
signature: Signature,
- aliases: Vec<String>,
requirement_satisfied: bool,
}
@@ -72,7 +71,6 @@ impl Default for FirstValue {
impl FirstValue {
pub fn new() -> Self {
Self {
- aliases: vec![String::from("first_value")],
signature: Signature::one_of(
vec![
// TODO: we can introduce more strict signature that only
numeric of array types are allowed
@@ -97,7 +95,7 @@ impl AggregateUDFImpl for FirstValue {
}
fn name(&self) -> &str {
- "FIRST_VALUE"
+ "first_value"
}
fn signature(&self) -> &Signature {
@@ -144,7 +142,7 @@ impl AggregateUDFImpl for FirstValue {
}
fn aliases(&self) -> &[String] {
- &self.aliases
+ &[]
}
fn with_beneficial_ordering(
@@ -349,7 +347,6 @@ make_udaf_expr_and_func!(
pub struct LastValue {
signature: Signature,
- aliases: Vec<String>,
requirement_satisfied: bool,
}
@@ -372,7 +369,6 @@ impl Default for LastValue {
impl LastValue {
pub fn new() -> Self {
Self {
- aliases: vec![String::from("last_value")],
signature: Signature::one_of(
vec![
// TODO: we can introduce more strict signature that only
numeric of array types are allowed
@@ -397,7 +393,7 @@ impl AggregateUDFImpl for LastValue {
}
fn name(&self) -> &str {
- "LAST_VALUE"
+ "last_value"
}
fn signature(&self) -> &Signature {
@@ -449,7 +445,7 @@ impl AggregateUDFImpl for LastValue {
}
fn aliases(&self) -> &[String] {
- &self.aliases
+ &[]
}
fn with_beneficial_ordering(
diff --git a/datafusion/functions-aggregate/src/lib.rs
b/datafusion/functions-aggregate/src/lib.rs
index 0c13952cc5..b0408c106f 100644
--- a/datafusion/functions-aggregate/src/lib.rs
+++ b/datafusion/functions-aggregate/src/lib.rs
@@ -109,13 +109,13 @@ mod tests {
let mut names = HashSet::new();
for func in all_default_aggregate_functions() {
assert!(
- names.insert(func.name().to_string()),
+ names.insert(func.name().to_string().to_lowercase()),
"duplicate function name: {}",
func.name()
);
for alias in func.aliases() {
assert!(
- names.insert(alias.to_string()),
+ names.insert(alias.to_string().to_lowercase()),
"duplicate function name: {}",
alias
);
diff --git a/datafusion/functions-aggregate/src/median.rs
b/datafusion/functions-aggregate/src/median.rs
index b3fb05d7fc..c8bc78ac2d 100644
--- a/datafusion/functions-aggregate/src/median.rs
+++ b/datafusion/functions-aggregate/src/median.rs
@@ -58,7 +58,6 @@ make_udaf_expr_and_func!(
/// result, but if cardinality is low then memory usage will also be lower.
pub struct Median {
signature: Signature,
- aliases: Vec<String>,
}
impl Debug for Median {
@@ -79,7 +78,6 @@ impl Default for Median {
impl Median {
pub fn new() -> Self {
Self {
- aliases: vec!["median".to_string()],
signature: Signature::numeric(1, Volatility::Immutable),
}
}
@@ -91,7 +89,7 @@ impl AggregateUDFImpl for Median {
}
fn name(&self) -> &str {
- "MEDIAN"
+ "median"
}
fn signature(&self) -> &Signature {
@@ -152,7 +150,7 @@ impl AggregateUDFImpl for Median {
}
fn aliases(&self) -> &[String] {
- &self.aliases
+ &[]
}
}
diff --git a/datafusion/functions-array/src/lib.rs
b/datafusion/functions-array/src/lib.rs
index 63ba5d1483..b2fcb5717b 100644
--- a/datafusion/functions-array/src/lib.rs
+++ b/datafusion/functions-array/src/lib.rs
@@ -168,13 +168,13 @@ mod tests {
let mut names = HashSet::new();
for func in all_default_array_functions() {
assert!(
- names.insert(func.name().to_string()),
+ names.insert(func.name().to_string().to_lowercase()),
"duplicate function name: {}",
func.name()
);
for alias in func.aliases() {
assert!(
- names.insert(alias.to_string()),
+ names.insert(alias.to_string().to_lowercase()),
"duplicate function name: {}",
alias
);
diff --git a/datafusion/functions/src/lib.rs b/datafusion/functions/src/lib.rs
index e36c491fef..4bc24931d0 100644
--- a/datafusion/functions/src/lib.rs
+++ b/datafusion/functions/src/lib.rs
@@ -191,13 +191,13 @@ mod tests {
let mut names = HashSet::new();
for func in all_default_functions() {
assert!(
- names.insert(func.name().to_string()),
+ names.insert(func.name().to_string().to_lowercase()),
"duplicate function name: {}",
func.name()
);
for alias in func.aliases() {
assert!(
- names.insert(alias.to_string()),
+ names.insert(alias.to_string().to_lowercase()),
"duplicate function name: {}",
alias
);
diff --git a/datafusion/optimizer/src/replace_distinct_aggregate.rs
b/datafusion/optimizer/src/replace_distinct_aggregate.rs
index c232935f9e..dcd13c58b9 100644
--- a/datafusion/optimizer/src/replace_distinct_aggregate.rs
+++ b/datafusion/optimizer/src/replace_distinct_aggregate.rs
@@ -201,9 +201,9 @@ mod tests {
)?
.build()?;
- let expected = "Projection: FIRST_VALUE(test.b) ORDER BY [test.a DESC
NULLS FIRST, test.c ASC NULLS LAST] AS b\
+ let expected = "Projection: first_value(test.b) ORDER BY [test.a DESC
NULLS FIRST, test.c ASC NULLS LAST] AS b\
\n Sort: test.a DESC NULLS FIRST\
- \n Aggregate: groupBy=[[test.a]], aggr=[[FIRST_VALUE(test.b) ORDER
BY [test.a DESC NULLS FIRST, test.c ASC NULLS LAST]]]\
+ \n Aggregate: groupBy=[[test.a]], aggr=[[first_value(test.b) ORDER
BY [test.a DESC NULLS FIRST, test.c ASC NULLS LAST]]]\
\n TableScan: test";
assert_optimized_plan_eq(
diff --git a/datafusion/sqllogictest/test_files/aggregate.slt
b/datafusion/sqllogictest/test_files/aggregate.slt
index fec8586ee3..256fddd9f2 100644
--- a/datafusion/sqllogictest/test_files/aggregate.slt
+++ b/datafusion/sqllogictest/test_files/aggregate.slt
@@ -879,15 +879,15 @@ query TT
explain select median(distinct c) from t;
----
logical_plan
-01)Projection: MEDIAN(alias1) AS MEDIAN(DISTINCT t.c)
-02)--Aggregate: groupBy=[[]], aggr=[[MEDIAN(alias1)]]
+01)Projection: median(alias1) AS median(DISTINCT t.c)
+02)--Aggregate: groupBy=[[]], aggr=[[median(alias1)]]
03)----Aggregate: groupBy=[[t.c AS alias1]], aggr=[[]]
04)------TableScan: t projection=[c]
physical_plan
-01)ProjectionExec: expr=[MEDIAN(alias1)@0 as MEDIAN(DISTINCT t.c)]
-02)--AggregateExec: mode=Final, gby=[], aggr=[MEDIAN(alias1)]
+01)ProjectionExec: expr=[median(alias1)@0 as median(DISTINCT t.c)]
+02)--AggregateExec: mode=Final, gby=[], aggr=[median(alias1)]
03)----CoalescePartitionsExec
-04)------AggregateExec: mode=Partial, gby=[], aggr=[MEDIAN(alias1)]
+04)------AggregateExec: mode=Partial, gby=[], aggr=[median(alias1)]
05)--------AggregateExec: mode=FinalPartitioned, gby=[alias1@0 as alias1],
aggr=[]
06)----------CoalesceBatchesExec: target_batch_size=8192
07)------------RepartitionExec: partitioning=Hash([alias1@0], 4),
input_partitions=4
@@ -5024,12 +5024,12 @@ query TT
explain select first_value(c1 order by c3 desc) from convert_first_last_table;
----
logical_plan
-01)Aggregate: groupBy=[[]], aggr=[[FIRST_VALUE(convert_first_last_table.c1)
ORDER BY [convert_first_last_table.c3 DESC NULLS FIRST]]]
+01)Aggregate: groupBy=[[]], aggr=[[first_value(convert_first_last_table.c1)
ORDER BY [convert_first_last_table.c3 DESC NULLS FIRST]]]
02)--TableScan: convert_first_last_table projection=[c1, c3]
physical_plan
-01)AggregateExec: mode=Final, gby=[],
aggr=[FIRST_VALUE(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c3 DESC NULLS FIRST]]
+01)AggregateExec: mode=Final, gby=[],
aggr=[first_value(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c3 DESC NULLS FIRST]]
02)--CoalescePartitionsExec
-03)----AggregateExec: mode=Partial, gby=[],
aggr=[LAST_VALUE(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c3 ASC NULLS LAST]]
+03)----AggregateExec: mode=Partial, gby=[],
aggr=[last_value(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c3 ASC NULLS LAST]]
04)------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
05)--------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/convert_first_last.csv]]},
projection=[c1, c3], output_orderings=[[c1@0 ASC NULLS LAST], [c3@1 ASC NULLS
LAST]], has_header=true
@@ -5038,11 +5038,11 @@ query TT
explain select last_value(c1 order by c2 asc) from convert_first_last_table;
----
logical_plan
-01)Aggregate: groupBy=[[]], aggr=[[LAST_VALUE(convert_first_last_table.c1)
ORDER BY [convert_first_last_table.c2 ASC NULLS LAST]]]
+01)Aggregate: groupBy=[[]], aggr=[[last_value(convert_first_last_table.c1)
ORDER BY [convert_first_last_table.c2 ASC NULLS LAST]]]
02)--TableScan: convert_first_last_table projection=[c1, c2]
physical_plan
-01)AggregateExec: mode=Final, gby=[],
aggr=[LAST_VALUE(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c2 ASC NULLS LAST]]
+01)AggregateExec: mode=Final, gby=[],
aggr=[last_value(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c2 ASC NULLS LAST]]
02)--CoalescePartitionsExec
-03)----AggregateExec: mode=Partial, gby=[],
aggr=[FIRST_VALUE(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c2 DESC NULLS FIRST]]
+03)----AggregateExec: mode=Partial, gby=[],
aggr=[first_value(convert_first_last_table.c1) ORDER BY
[convert_first_last_table.c2 DESC NULLS FIRST]]
04)------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
05)--------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/convert_first_last.csv]]},
projection=[c1, c2], output_orderings=[[c1@0 ASC NULLS LAST], [c2@1 DESC]],
has_header=true
diff --git a/datafusion/sqllogictest/test_files/distinct_on.slt
b/datafusion/sqllogictest/test_files/distinct_on.slt
index cdef2990fa..beef865bca 100644
--- a/datafusion/sqllogictest/test_files/distinct_on.slt
+++ b/datafusion/sqllogictest/test_files/distinct_on.slt
@@ -89,18 +89,18 @@ query TT
EXPLAIN SELECT DISTINCT ON (c1) c3, c2 FROM aggregate_test_100 ORDER BY c1, c3;
----
logical_plan
-01)Projection: FIRST_VALUE(aggregate_test_100.c3) ORDER BY
[aggregate_test_100.c1 ASC NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST] AS
c3, FIRST_VALUE(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST] AS c2
+01)Projection: first_value(aggregate_test_100.c3) ORDER BY
[aggregate_test_100.c1 ASC NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST] AS
c3, first_value(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST] AS c2
02)--Sort: aggregate_test_100.c1 ASC NULLS LAST
-03)----Aggregate: groupBy=[[aggregate_test_100.c1]],
aggr=[[FIRST_VALUE(aggregate_test_100.c3) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST],
FIRST_VALUE(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC NULLS
LAST, aggregate_test_100.c3 ASC NULLS LAST]]]
+03)----Aggregate: groupBy=[[aggregate_test_100.c1]],
aggr=[[first_value(aggregate_test_100.c3) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST],
first_value(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC NULLS
LAST, aggregate_test_100.c3 ASC NULLS LAST]]]
04)------TableScan: aggregate_test_100 projection=[c1, c2, c3]
physical_plan
-01)ProjectionExec: expr=[FIRST_VALUE(aggregate_test_100.c3) ORDER BY
[aggregate_test_100.c1 ASC NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST]@1
as c3, FIRST_VALUE(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST]@2 as c2]
+01)ProjectionExec: expr=[first_value(aggregate_test_100.c3) ORDER BY
[aggregate_test_100.c1 ASC NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST]@1
as c3, first_value(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST]@2 as c2]
02)--SortPreservingMergeExec: [c1@0 ASC NULLS LAST]
03)----SortExec: expr=[c1@0 ASC NULLS LAST], preserve_partitioning=[true]
-04)------AggregateExec: mode=FinalPartitioned, gby=[c1@0 as c1],
aggr=[FIRST_VALUE(aggregate_test_100.c3) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST],
FIRST_VALUE(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC NULLS
LAST, aggregate_test_100.c3 ASC NULLS LAST]]
+04)------AggregateExec: mode=FinalPartitioned, gby=[c1@0 as c1],
aggr=[first_value(aggregate_test_100.c3) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST],
first_value(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC NULLS
LAST, aggregate_test_100.c3 ASC NULLS LAST]]
05)--------CoalesceBatchesExec: target_batch_size=8192
06)----------RepartitionExec: partitioning=Hash([c1@0], 4), input_partitions=4
-07)------------AggregateExec: mode=Partial, gby=[c1@0 as c1],
aggr=[FIRST_VALUE(aggregate_test_100.c3) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST],
FIRST_VALUE(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC NULLS
LAST, aggregate_test_100.c3 ASC NULLS LAST]]
+07)------------AggregateExec: mode=Partial, gby=[c1@0 as c1],
aggr=[first_value(aggregate_test_100.c3) ORDER BY [aggregate_test_100.c1 ASC
NULLS LAST, aggregate_test_100.c3 ASC NULLS LAST],
first_value(aggregate_test_100.c2) ORDER BY [aggregate_test_100.c1 ASC NULLS
LAST, aggregate_test_100.c3 ASC NULLS LAST]]
08)--------------RepartitionExec: partitioning=RoundRobinBatch(4),
input_partitions=1
09)----------------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c1,
c2, c3], has_header=true
diff --git a/datafusion/sqllogictest/test_files/group_by.slt
b/datafusion/sqllogictest/test_files/group_by.slt
index 7f4106a27c..efbf0df383 100644
--- a/datafusion/sqllogictest/test_files/group_by.slt
+++ b/datafusion/sqllogictest/test_files/group_by.slt
@@ -2005,8 +2005,8 @@ ORDER BY l.col0;
----
logical_plan
01)Sort: l.col0 ASC NULLS LAST
-02)--Projection: l.col0, LAST_VALUE(r.col1) ORDER BY [r.col0 ASC NULLS LAST]
AS last_col1
-03)----Aggregate: groupBy=[[l.col0, l.col1, l.col2]],
aggr=[[LAST_VALUE(r.col1) ORDER BY [r.col0 ASC NULLS LAST]]]
+02)--Projection: l.col0, last_value(r.col1) ORDER BY [r.col0 ASC NULLS LAST]
AS last_col1
+03)----Aggregate: groupBy=[[l.col0, l.col1, l.col2]],
aggr=[[last_value(r.col1) ORDER BY [r.col0 ASC NULLS LAST]]]
04)------Inner Join: l.col0 = r.col0
05)--------SubqueryAlias: l
06)----------TableScan: tab0 projection=[col0, col1, col2]
@@ -2015,11 +2015,11 @@ logical_plan
physical_plan
01)SortPreservingMergeExec: [col0@0 ASC NULLS LAST]
02)--SortExec: expr=[col0@0 ASC NULLS LAST], preserve_partitioning=[true]
-03)----ProjectionExec: expr=[col0@0 as col0, LAST_VALUE(r.col1) ORDER BY
[r.col0 ASC NULLS LAST]@3 as last_col1]
-04)------AggregateExec: mode=FinalPartitioned, gby=[col0@0 as col0, col1@1 as
col1, col2@2 as col2], aggr=[LAST_VALUE(r.col1) ORDER BY [r.col0 ASC NULLS
LAST]]
+03)----ProjectionExec: expr=[col0@0 as col0, last_value(r.col1) ORDER BY
[r.col0 ASC NULLS LAST]@3 as last_col1]
+04)------AggregateExec: mode=FinalPartitioned, gby=[col0@0 as col0, col1@1 as
col1, col2@2 as col2], aggr=[last_value(r.col1) ORDER BY [r.col0 ASC NULLS
LAST]]
05)--------CoalesceBatchesExec: target_batch_size=8192
06)----------RepartitionExec: partitioning=Hash([col0@0, col1@1, col2@2], 4),
input_partitions=4
-07)------------AggregateExec: mode=Partial, gby=[col0@0 as col0, col1@1 as
col1, col2@2 as col2], aggr=[LAST_VALUE(r.col1) ORDER BY [r.col0 ASC NULLS
LAST]]
+07)------------AggregateExec: mode=Partial, gby=[col0@0 as col0, col1@1 as
col1, col2@2 as col2], aggr=[last_value(r.col1) ORDER BY [r.col0 ASC NULLS
LAST]]
08)--------------ProjectionExec: expr=[col0@2 as col0, col1@3 as col1, col2@4
as col2, col0@0 as col0, col1@1 as col1]
09)----------------CoalesceBatchesExec: target_batch_size=8192
10)------------------HashJoinExec: mode=Partitioned, join_type=Inner,
on=[(col0@0, col0@0)]
@@ -2173,12 +2173,12 @@ EXPLAIN SELECT a, b, FIRST_VALUE(c ORDER BY a DESC) as
first_c
GROUP BY a, b
----
logical_plan
-01)Projection: annotated_data_infinite2.a, annotated_data_infinite2.b,
FIRST_VALUE(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST] AS first_c
-02)--Aggregate: groupBy=[[annotated_data_infinite2.a,
annotated_data_infinite2.b]], aggr=[[FIRST_VALUE(annotated_data_infinite2.c)
ORDER BY [annotated_data_infinite2.a DESC NULLS FIRST]]]
+01)Projection: annotated_data_infinite2.a, annotated_data_infinite2.b,
first_value(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST] AS first_c
+02)--Aggregate: groupBy=[[annotated_data_infinite2.a,
annotated_data_infinite2.b]], aggr=[[first_value(annotated_data_infinite2.c)
ORDER BY [annotated_data_infinite2.a DESC NULLS FIRST]]]
03)----TableScan: annotated_data_infinite2 projection=[a, b, c]
physical_plan
-01)ProjectionExec: expr=[a@0 as a, b@1 as b,
FIRST_VALUE(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST]@2 as first_c]
-02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b],
aggr=[FIRST_VALUE(annotated_data_infinite2.c) ORDER BY
[annotated_data_infinite2.a DESC NULLS FIRST]], ordering_mode=Sorted
+01)ProjectionExec: expr=[a@0 as a, b@1 as b,
first_value(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST]@2 as first_c]
+02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b],
aggr=[first_value(annotated_data_infinite2.c) ORDER BY
[annotated_data_infinite2.a DESC NULLS FIRST]], ordering_mode=Sorted
03)----StreamingTableExec: partition_sizes=1, projection=[a, b, c],
infinite_source=true, output_ordering=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST,
c@2 ASC NULLS LAST]
query III
@@ -2199,12 +2199,12 @@ EXPLAIN SELECT a, b, LAST_VALUE(c ORDER BY a DESC) as
last_c
GROUP BY a, b
----
logical_plan
-01)Projection: annotated_data_infinite2.a, annotated_data_infinite2.b,
LAST_VALUE(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST] AS last_c
-02)--Aggregate: groupBy=[[annotated_data_infinite2.a,
annotated_data_infinite2.b]], aggr=[[LAST_VALUE(annotated_data_infinite2.c)
ORDER BY [annotated_data_infinite2.a DESC NULLS FIRST]]]
+01)Projection: annotated_data_infinite2.a, annotated_data_infinite2.b,
last_value(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST] AS last_c
+02)--Aggregate: groupBy=[[annotated_data_infinite2.a,
annotated_data_infinite2.b]], aggr=[[last_value(annotated_data_infinite2.c)
ORDER BY [annotated_data_infinite2.a DESC NULLS FIRST]]]
03)----TableScan: annotated_data_infinite2 projection=[a, b, c]
physical_plan
-01)ProjectionExec: expr=[a@0 as a, b@1 as b,
LAST_VALUE(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST]@2 as last_c]
-02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b],
aggr=[LAST_VALUE(annotated_data_infinite2.c) ORDER BY
[annotated_data_infinite2.a DESC NULLS FIRST]], ordering_mode=Sorted
+01)ProjectionExec: expr=[a@0 as a, b@1 as b,
last_value(annotated_data_infinite2.c) ORDER BY [annotated_data_infinite2.a
DESC NULLS FIRST]@2 as last_c]
+02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b],
aggr=[last_value(annotated_data_infinite2.c) ORDER BY
[annotated_data_infinite2.a DESC NULLS FIRST]], ordering_mode=Sorted
03)----StreamingTableExec: partition_sizes=1, projection=[a, b, c],
infinite_source=true, output_ordering=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST,
c@2 ASC NULLS LAST]
query III
@@ -2226,12 +2226,12 @@ EXPLAIN SELECT a, b, LAST_VALUE(c) as last_c
GROUP BY a, b
----
logical_plan
-01)Projection: annotated_data_infinite2.a, annotated_data_infinite2.b,
LAST_VALUE(annotated_data_infinite2.c) AS last_c
-02)--Aggregate: groupBy=[[annotated_data_infinite2.a,
annotated_data_infinite2.b]], aggr=[[LAST_VALUE(annotated_data_infinite2.c)]]
+01)Projection: annotated_data_infinite2.a, annotated_data_infinite2.b,
last_value(annotated_data_infinite2.c) AS last_c
+02)--Aggregate: groupBy=[[annotated_data_infinite2.a,
annotated_data_infinite2.b]], aggr=[[last_value(annotated_data_infinite2.c)]]
03)----TableScan: annotated_data_infinite2 projection=[a, b, c]
physical_plan
-01)ProjectionExec: expr=[a@0 as a, b@1 as b,
LAST_VALUE(annotated_data_infinite2.c)@2 as last_c]
-02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b],
aggr=[LAST_VALUE(annotated_data_infinite2.c)], ordering_mode=Sorted
+01)ProjectionExec: expr=[a@0 as a, b@1 as b,
last_value(annotated_data_infinite2.c)@2 as last_c]
+02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b],
aggr=[last_value(annotated_data_infinite2.c)], ordering_mode=Sorted
03)----StreamingTableExec: partition_sizes=1, projection=[a, b, c],
infinite_source=true, output_ordering=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST,
c@2 ASC NULLS LAST]
query III
@@ -2672,12 +2672,12 @@ EXPLAIN SELECT country, ARRAY_AGG(amount ORDER BY
amount DESC) AS amounts,
GROUP BY country
----
logical_plan
-01)Projection: sales_global.country, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount DESC NULLS FIRST] AS amounts,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST]
AS fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST] AS fv2
-02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC
NULLS LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST]]]
+01)Projection: sales_global.country, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount DESC NULLS FIRST] AS amounts,
first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST]
AS fv1, last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST] AS fv2
+02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC
NULLS LAST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST]]]
03)----TableScan: sales_global projection=[country, amount]
physical_plan
-01)ProjectionExec: expr=[country@0 as country, ARRAY_AGG(sales_global.amount)
ORDER BY [sales_global.amount DESC NULLS FIRST]@1 as amounts,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]@2 as fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]@3 as fv2]
-02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]]
+01)ProjectionExec: expr=[country@0 as country, ARRAY_AGG(sales_global.amount)
ORDER BY [sales_global.amount DESC NULLS FIRST]@1 as amounts,
first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]@2 as fv1, last_value(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]@3 as fv2]
+02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST], last_value(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]]
03)----SortExec: expr=[amount@1 DESC], preserve_partitioning=[false]
04)------MemoryExec: partitions=1, partition_sizes=[1]
@@ -2703,12 +2703,12 @@ EXPLAIN SELECT country, ARRAY_AGG(amount ORDER BY
amount ASC) AS amounts,
GROUP BY country
----
logical_plan
-01)Projection: sales_global.country, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST] AS amounts,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST]
AS fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST] AS fv2
-02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST]]]
+01)Projection: sales_global.country, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST] AS amounts,
first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST]
AS fv1, last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST] AS fv2
+02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST]]]
03)----TableScan: sales_global projection=[country, amount]
physical_plan
-01)ProjectionExec: expr=[country@0 as country, ARRAY_AGG(sales_global.amount)
ORDER BY [sales_global.amount ASC NULLS LAST]@1 as amounts,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]@2 as fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]@3 as fv2]
-02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]]
+01)ProjectionExec: expr=[country@0 as country, ARRAY_AGG(sales_global.amount)
ORDER BY [sales_global.amount ASC NULLS LAST]@1 as amounts,
first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]@2 as fv1, last_value(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]@3 as fv2]
+02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]]
03)----SortExec: expr=[amount@1 ASC NULLS LAST], preserve_partitioning=[false]
04)------MemoryExec: partitions=1, partition_sizes=[1]
@@ -2735,12 +2735,12 @@ EXPLAIN SELECT country, FIRST_VALUE(amount ORDER BY
amount ASC) AS fv1,
GROUP BY country
----
logical_plan
-01)Projection: sales_global.country, FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST] AS fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.amount DESC NULLS FIRST] AS fv2,
ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST] AS
amounts
-02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]]]
+01)Projection: sales_global.country, first_value(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST] AS fv1, last_value(sales_global.amount)
ORDER BY [sales_global.amount DESC NULLS FIRST] AS fv2,
ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST] AS
amounts
+02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]]]
03)----TableScan: sales_global projection=[country, amount]
physical_plan
-01)ProjectionExec: expr=[country@0 as country,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]@1 as fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]@2 as fv2, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST]@3 as amounts]
-02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]]
+01)ProjectionExec: expr=[country@0 as country,
first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]@1 as fv1, last_value(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]@2 as fv2, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST]@3 as amounts]
+02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST], ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS
LAST]]
03)----SortExec: expr=[amount@1 ASC NULLS LAST], preserve_partitioning=[false]
04)------MemoryExec: partitions=1, partition_sizes=[1]
@@ -2799,13 +2799,13 @@ EXPLAIN SELECT country, FIRST_VALUE(amount ORDER BY ts
DESC) as fv1,
GROUP BY country
----
logical_plan
-01)Projection: sales_global.country, FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts DESC NULLS FIRST] AS fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS lv1, SUM(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS sum1
-02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(CAST(sales_global.amount AS Float64)) ORDER BY [sales_global.ts
DESC NULLS FIRST]]]
+01)Projection: sales_global.country, first_value(sales_global.amount) ORDER BY
[sales_global.ts DESC NULLS FIRST] AS fv1, last_value(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS lv1, SUM(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS sum1
+02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[first_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(CAST(sales_global.amount AS Float64)) ORDER BY [sales_global.ts
DESC NULLS FIRST]]]
03)----Sort: sales_global.ts ASC NULLS LAST
04)------TableScan: sales_global projection=[country, ts, amount]
physical_plan
-01)ProjectionExec: expr=[country@0 as country,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]@1
as fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@2 as lv1, SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@3 as sum1]
-02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]]
+01)ProjectionExec: expr=[country@0 as country,
first_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]@1
as fv1, last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@2 as lv1, SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@3 as sum1]
+02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]]
03)----MemoryExec: partitions=1, partition_sizes=[1]
query TRRR rowsort
@@ -2833,12 +2833,12 @@ EXPLAIN SELECT country, FIRST_VALUE(amount ORDER BY ts
DESC) as fv1,
GROUP BY country
----
logical_plan
-01)Projection: sales_global.country, FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts DESC NULLS FIRST] AS fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS lv1, SUM(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS sum1
-02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(CAST(sales_global.amount AS Float64)) ORDER BY [sales_global.ts
DESC NULLS FIRST]]]
+01)Projection: sales_global.country, first_value(sales_global.amount) ORDER BY
[sales_global.ts DESC NULLS FIRST] AS fv1, last_value(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS lv1, SUM(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS sum1
+02)--Aggregate: groupBy=[[sales_global.country]],
aggr=[[first_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(CAST(sales_global.amount AS Float64)) ORDER BY [sales_global.ts
DESC NULLS FIRST]]]
03)----TableScan: sales_global projection=[country, ts, amount]
physical_plan
-01)ProjectionExec: expr=[country@0 as country,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]@1
as fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@2 as lv1, SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@3 as sum1]
-02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]]
+01)ProjectionExec: expr=[country@0 as country,
first_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]@1
as fv1, last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@2 as lv1, SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@3 as sum1]
+02)--AggregateExec: mode=Single, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST], SUM(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS FIRST]]
03)----MemoryExec: partitions=1, partition_sizes=[1]
query TRRR rowsort
@@ -2863,8 +2863,8 @@ ORDER BY s.sn
----
logical_plan
01)Sort: s.sn ASC NULLS LAST
-02)--Projection: s.zip_code, s.country, s.sn, s.ts, s.currency,
LAST_VALUE(e.amount) ORDER BY [e.sn ASC NULLS LAST] AS last_rate
-03)----Aggregate: groupBy=[[s.sn, s.zip_code, s.country, s.ts, s.currency]],
aggr=[[LAST_VALUE(e.amount) ORDER BY [e.sn ASC NULLS LAST]]]
+02)--Projection: s.zip_code, s.country, s.sn, s.ts, s.currency,
last_value(e.amount) ORDER BY [e.sn ASC NULLS LAST] AS last_rate
+03)----Aggregate: groupBy=[[s.sn, s.zip_code, s.country, s.ts, s.currency]],
aggr=[[last_value(e.amount) ORDER BY [e.sn ASC NULLS LAST]]]
04)------Projection: s.zip_code, s.country, s.sn, s.ts, s.currency, e.sn,
e.amount
05)--------Inner Join: s.currency = e.currency Filter: s.ts >= e.ts
06)----------SubqueryAlias: s
@@ -2873,8 +2873,8 @@ logical_plan
09)------------TableScan: sales_global projection=[sn, ts, currency, amount]
physical_plan
01)SortExec: expr=[sn@2 ASC NULLS LAST], preserve_partitioning=[false]
-02)--ProjectionExec: expr=[zip_code@1 as zip_code, country@2 as country, sn@0
as sn, ts@3 as ts, currency@4 as currency, LAST_VALUE(e.amount) ORDER BY [e.sn
ASC NULLS LAST]@5 as last_rate]
-03)----AggregateExec: mode=Single, gby=[sn@2 as sn, zip_code@0 as zip_code,
country@1 as country, ts@3 as ts, currency@4 as currency],
aggr=[LAST_VALUE(e.amount) ORDER BY [e.sn ASC NULLS LAST]]
+02)--ProjectionExec: expr=[zip_code@1 as zip_code, country@2 as country, sn@0
as sn, ts@3 as ts, currency@4 as currency, last_value(e.amount) ORDER BY [e.sn
ASC NULLS LAST]@5 as last_rate]
+03)----AggregateExec: mode=Single, gby=[sn@2 as sn, zip_code@0 as zip_code,
country@1 as country, ts@3 as ts, currency@4 as currency],
aggr=[last_value(e.amount) ORDER BY [e.sn ASC NULLS LAST]]
04)------ProjectionExec: expr=[zip_code@2 as zip_code, country@3 as country,
sn@4 as sn, ts@5 as ts, currency@6 as currency, sn@0 as sn, amount@1 as amount]
05)--------CoalesceBatchesExec: target_batch_size=8192
06)----------HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(currency@2,
currency@4)], filter=ts@0 >= ts@1, projection=[sn@0, amount@3, zip_code@4,
country@5, sn@6, ts@7, currency@8]
@@ -2912,18 +2912,18 @@ EXPLAIN SELECT country, FIRST_VALUE(amount ORDER BY ts
ASC) AS fv1,
----
logical_plan
01)Sort: sales_global.country ASC NULLS LAST
-02)--Projection: sales_global.country, FIRST_VALUE(sales_global.amount) ORDER
BY [sales_global.ts ASC NULLS LAST] AS fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST] AS fv2
-03)----Aggregate: groupBy=[[sales_global.country]],
aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]]
+02)--Projection: sales_global.country, first_value(sales_global.amount) ORDER
BY [sales_global.ts ASC NULLS LAST] AS fv1, last_value(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST] AS fv2
+03)----Aggregate: groupBy=[[sales_global.country]],
aggr=[[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]]
04)------TableScan: sales_global projection=[country, ts, amount]
physical_plan
01)SortPreservingMergeExec: [country@0 ASC NULLS LAST]
02)--SortExec: expr=[country@0 ASC NULLS LAST], preserve_partitioning=[true]
-03)----ProjectionExec: expr=[country@0 as country,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS LAST]@1 as
fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]@2 as fv2]
-04)------AggregateExec: mode=FinalPartitioned, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]
+03)----ProjectionExec: expr=[country@0 as country,
first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS LAST]@1 as
fv1, last_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]@2 as fv2]
+04)------AggregateExec: mode=FinalPartitioned, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]
05)--------CoalesceBatchesExec: target_batch_size=8192
06)----------RepartitionExec: partitioning=Hash([country@0], 8),
input_partitions=8
07)------------RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1
-08)--------------AggregateExec: mode=Partial, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]
+08)--------------AggregateExec: mode=Partial, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]
09)----------------MemoryExec: partitions=1, partition_sizes=[1]
query TRR
@@ -2948,18 +2948,18 @@ EXPLAIN SELECT country, FIRST_VALUE(amount ORDER BY ts
ASC) AS fv1,
----
logical_plan
01)Sort: sales_global.country ASC NULLS LAST
-02)--Projection: sales_global.country, FIRST_VALUE(sales_global.amount) ORDER
BY [sales_global.ts ASC NULLS LAST] AS fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS fv2
-03)----Aggregate: groupBy=[[sales_global.country]],
aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]]
+02)--Projection: sales_global.country, first_value(sales_global.amount) ORDER
BY [sales_global.ts ASC NULLS LAST] AS fv1, last_value(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST] AS fv2
+03)----Aggregate: groupBy=[[sales_global.country]],
aggr=[[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]]
04)------TableScan: sales_global projection=[country, ts, amount]
physical_plan
01)SortPreservingMergeExec: [country@0 ASC NULLS LAST]
02)--SortExec: expr=[country@0 ASC NULLS LAST], preserve_partitioning=[true]
-03)----ProjectionExec: expr=[country@0 as country,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS LAST]@1 as
fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@2 as fv2]
-04)------AggregateExec: mode=FinalPartitioned, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]
+03)----ProjectionExec: expr=[country@0 as country,
first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS LAST]@1 as
fv1, last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]@2 as fv2]
+04)------AggregateExec: mode=FinalPartitioned, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]
05)--------CoalesceBatchesExec: target_batch_size=8192
06)----------RepartitionExec: partitioning=Hash([country@0], 8),
input_partitions=8
07)------------RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1
-08)--------------AggregateExec: mode=Partial, gby=[country@0 as country],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]
+08)--------------AggregateExec: mode=Partial, gby=[country@0 as country],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]
09)----------------MemoryExec: partitions=1, partition_sizes=[1]
query TRR
@@ -2986,14 +2986,14 @@ EXPLAIN SELECT FIRST_VALUE(amount ORDER BY ts ASC) AS
fv1,
FROM sales_global
----
logical_plan
-01)Projection: FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC
NULLS LAST] AS fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts
ASC NULLS LAST] AS fv2
-02)--Aggregate: groupBy=[[]], aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST], LAST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST]]]
+01)Projection: first_value(sales_global.amount) ORDER BY [sales_global.ts ASC
NULLS LAST] AS fv1, last_value(sales_global.amount) ORDER BY [sales_global.ts
ASC NULLS LAST] AS fv2
+02)--Aggregate: groupBy=[[]], aggr=[[first_value(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST], last_value(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST]]]
03)----TableScan: sales_global projection=[ts, amount]
physical_plan
-01)ProjectionExec: expr=[FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST]@0 as fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST]@1 as fv2]
-02)--AggregateExec: mode=Final, gby=[], aggr=[FIRST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST], LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST]]
+01)ProjectionExec: expr=[first_value(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST]@0 as fv1, last_value(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST]@1 as fv2]
+02)--AggregateExec: mode=Final, gby=[], aggr=[first_value(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST], last_value(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST]]
03)----CoalescePartitionsExec
-04)------AggregateExec: mode=Partial, gby=[],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]
+04)------AggregateExec: mode=Partial, gby=[],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST]]
05)--------RepartitionExec: partitioning=RoundRobinBatch(8), input_partitions=1
06)----------MemoryExec: partitions=1, partition_sizes=[1]
@@ -3012,14 +3012,14 @@ EXPLAIN SELECT FIRST_VALUE(amount ORDER BY ts ASC) AS
fv1,
FROM sales_global
----
logical_plan
-01)Projection: FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC
NULLS LAST] AS fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts
DESC NULLS FIRST] AS fv2
-02)--Aggregate: groupBy=[[]], aggr=[[FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST], LAST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts DESC NULLS FIRST]]]
+01)Projection: first_value(sales_global.amount) ORDER BY [sales_global.ts ASC
NULLS LAST] AS fv1, last_value(sales_global.amount) ORDER BY [sales_global.ts
DESC NULLS FIRST] AS fv2
+02)--Aggregate: groupBy=[[]], aggr=[[first_value(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST], last_value(sales_global.amount) ORDER BY
[sales_global.ts DESC NULLS FIRST]]]
03)----TableScan: sales_global projection=[ts, amount]
physical_plan
-01)ProjectionExec: expr=[FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST]@0 as fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST]@1 as fv2]
-02)--AggregateExec: mode=Final, gby=[], aggr=[FIRST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST], LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST]]
+01)ProjectionExec: expr=[first_value(sales_global.amount) ORDER BY
[sales_global.ts ASC NULLS LAST]@0 as fv1, last_value(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST]@1 as fv2]
+02)--AggregateExec: mode=Final, gby=[], aggr=[first_value(sales_global.amount)
ORDER BY [sales_global.ts ASC NULLS LAST], last_value(sales_global.amount)
ORDER BY [sales_global.ts DESC NULLS FIRST]]
03)----CoalescePartitionsExec
-04)------AggregateExec: mode=Partial, gby=[],
aggr=[FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]
+04)------AggregateExec: mode=Partial, gby=[],
aggr=[first_value(sales_global.amount) ORDER BY [sales_global.ts ASC NULLS
LAST], last_value(sales_global.amount) ORDER BY [sales_global.ts DESC NULLS
FIRST]]
05)--------RepartitionExec: partitioning=RoundRobinBatch(8), input_partitions=1
06)----------MemoryExec: partitions=1, partition_sizes=[1]
@@ -3147,17 +3147,17 @@ EXPLAIN SELECT country, ARRAY_AGG(amount ORDER BY
amount DESC) AS amounts,
----
logical_plan
01)Sort: sales_global.country ASC NULLS LAST
-02)--Projection: sales_global.country, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount DESC NULLS FIRST] AS amounts,
FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST]
AS fv1, LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST] AS fv2
-03)----Aggregate: groupBy=[[sales_global.country]],
aggr=[[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC
NULLS LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST]]]
+02)--Projection: sales_global.country, ARRAY_AGG(sales_global.amount) ORDER BY
[sales_global.amount DESC NULLS FIRST] AS amounts,
first_value(sales_global.amount) ORDER BY [sales_global.amount ASC NULLS LAST]
AS fv1, last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST] AS fv2
+03)----Aggregate: groupBy=[[sales_global.country]],
aggr=[[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC
NULLS LAST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST]]]
04)------TableScan: sales_global projection=[country, amount]
physical_plan
01)SortPreservingMergeExec: [country@0 ASC NULLS LAST]
02)--SortExec: expr=[country@0 ASC NULLS LAST], preserve_partitioning=[true]
-03)----ProjectionExec: expr=[country@0 as country,
ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST]@1 as amounts, FIRST_VALUE(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST]@2 as fv1, LAST_VALUE(sales_global.amount)
ORDER BY [sales_global.amount DESC NULLS FIRST]@3 as fv2]
-04)------AggregateExec: mode=FinalPartitioned, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], FIRST_VALUE(sales_global.amount) ORDER BY [sales_global.amount ASC
NULLS LAST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST]]
+03)----ProjectionExec: expr=[country@0 as country,
ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST]@1 as amounts, first_value(sales_global.amount) ORDER BY
[sales_global.amount ASC NULLS LAST]@2 as fv1, last_value(sales_global.amount)
ORDER BY [sales_global.amount DESC NULLS FIRST]@3 as fv2]
+04)------AggregateExec: mode=FinalPartitioned, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], first_value(sales_global.amount) ORDER BY [sales_global.amount ASC
NULLS LAST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST]]
05)--------CoalesceBatchesExec: target_batch_size=4
06)----------RepartitionExec: partitioning=Hash([country@0], 8),
input_partitions=8
-07)------------AggregateExec: mode=Partial, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST], LAST_VALUE(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]]
+07)------------AggregateExec: mode=Partial, gby=[country@0 as country],
aggr=[ARRAY_AGG(sales_global.amount) ORDER BY [sales_global.amount DESC NULLS
FIRST], last_value(sales_global.amount) ORDER BY [sales_global.amount DESC
NULLS FIRST], last_value(sales_global.amount) ORDER BY [sales_global.amount
DESC NULLS FIRST]]
08)--------------SortExec: expr=[amount@1 DESC], preserve_partitioning=[true]
09)----------------RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1
10)------------------MemoryExec: partitions=1, partition_sizes=[1]
@@ -3755,12 +3755,12 @@ EXPLAIN SELECT LAST_VALUE(x)
FROM FOO;
----
logical_plan
-01)Aggregate: groupBy=[[]], aggr=[[LAST_VALUE(foo.x)]]
+01)Aggregate: groupBy=[[]], aggr=[[last_value(foo.x)]]
02)--TableScan: foo projection=[x]
physical_plan
-01)AggregateExec: mode=Final, gby=[], aggr=[LAST_VALUE(foo.x)]
+01)AggregateExec: mode=Final, gby=[], aggr=[last_value(foo.x)]
02)--CoalescePartitionsExec
-03)----AggregateExec: mode=Partial, gby=[], aggr=[LAST_VALUE(foo.x)]
+03)----AggregateExec: mode=Partial, gby=[], aggr=[last_value(foo.x)]
04)------RepartitionExec: partitioning=RoundRobinBatch(8), input_partitions=1
05)--------MemoryExec: partitions=1, partition_sizes=[1]
@@ -3777,12 +3777,12 @@ EXPLAIN SELECT FIRST_VALUE(x)
FROM FOO;
----
logical_plan
-01)Aggregate: groupBy=[[]], aggr=[[FIRST_VALUE(foo.x)]]
+01)Aggregate: groupBy=[[]], aggr=[[first_value(foo.x)]]
02)--TableScan: foo projection=[x]
physical_plan
-01)AggregateExec: mode=Final, gby=[], aggr=[FIRST_VALUE(foo.x)]
+01)AggregateExec: mode=Final, gby=[], aggr=[first_value(foo.x)]
02)--CoalescePartitionsExec
-03)----AggregateExec: mode=Partial, gby=[], aggr=[FIRST_VALUE(foo.x)]
+03)----AggregateExec: mode=Partial, gby=[], aggr=[first_value(foo.x)]
04)------RepartitionExec: partitioning=RoundRobinBatch(8), input_partitions=1
05)--------MemoryExec: partitions=1, partition_sizes=[1]
@@ -3795,15 +3795,15 @@ FROM multiple_ordered_table
GROUP BY d;
----
logical_plan
-01)Projection: FIRST_VALUE(multiple_ordered_table.a) ORDER BY
[multiple_ordered_table.a ASC NULLS LAST] AS first_a,
LAST_VALUE(multiple_ordered_table.c) ORDER BY [multiple_ordered_table.c DESC
NULLS FIRST] AS last_c
-02)--Aggregate: groupBy=[[multiple_ordered_table.d]],
aggr=[[FIRST_VALUE(multiple_ordered_table.a) ORDER BY [multiple_ordered_table.a
ASC NULLS LAST], LAST_VALUE(multiple_ordered_table.c) ORDER BY
[multiple_ordered_table.c DESC NULLS FIRST]]]
+01)Projection: first_value(multiple_ordered_table.a) ORDER BY
[multiple_ordered_table.a ASC NULLS LAST] AS first_a,
last_value(multiple_ordered_table.c) ORDER BY [multiple_ordered_table.c DESC
NULLS FIRST] AS last_c
+02)--Aggregate: groupBy=[[multiple_ordered_table.d]],
aggr=[[first_value(multiple_ordered_table.a) ORDER BY [multiple_ordered_table.a
ASC NULLS LAST], last_value(multiple_ordered_table.c) ORDER BY
[multiple_ordered_table.c DESC NULLS FIRST]]]
03)----TableScan: multiple_ordered_table projection=[a, c, d]
physical_plan
-01)ProjectionExec: expr=[FIRST_VALUE(multiple_ordered_table.a) ORDER BY
[multiple_ordered_table.a ASC NULLS LAST]@1 as first_a,
LAST_VALUE(multiple_ordered_table.c) ORDER BY [multiple_ordered_table.c DESC
NULLS FIRST]@2 as last_c]
-02)--AggregateExec: mode=FinalPartitioned, gby=[d@0 as d],
aggr=[FIRST_VALUE(multiple_ordered_table.a) ORDER BY [multiple_ordered_table.a
ASC NULLS LAST], LAST_VALUE(multiple_ordered_table.c) ORDER BY
[multiple_ordered_table.c DESC NULLS FIRST]]
+01)ProjectionExec: expr=[first_value(multiple_ordered_table.a) ORDER BY
[multiple_ordered_table.a ASC NULLS LAST]@1 as first_a,
last_value(multiple_ordered_table.c) ORDER BY [multiple_ordered_table.c DESC
NULLS FIRST]@2 as last_c]
+02)--AggregateExec: mode=FinalPartitioned, gby=[d@0 as d],
aggr=[first_value(multiple_ordered_table.a) ORDER BY [multiple_ordered_table.a
ASC NULLS LAST], last_value(multiple_ordered_table.c) ORDER BY
[multiple_ordered_table.c DESC NULLS FIRST]]
03)----CoalesceBatchesExec: target_batch_size=2
04)------RepartitionExec: partitioning=Hash([d@0], 8), input_partitions=8
-05)--------AggregateExec: mode=Partial, gby=[d@2 as d],
aggr=[FIRST_VALUE(multiple_ordered_table.a) ORDER BY [multiple_ordered_table.a
ASC NULLS LAST], FIRST_VALUE(multiple_ordered_table.c) ORDER BY
[multiple_ordered_table.c ASC NULLS LAST]]
+05)--------AggregateExec: mode=Partial, gby=[d@2 as d],
aggr=[first_value(multiple_ordered_table.a) ORDER BY [multiple_ordered_table.a
ASC NULLS LAST], first_value(multiple_ordered_table.c) ORDER BY
[multiple_ordered_table.c ASC NULLS LAST]]
06)----------RepartitionExec: partitioning=RoundRobinBatch(8),
input_partitions=1
07)------------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/window_2.csv]]}, projection=[a, c,
d], output_orderings=[[a@0 ASC NULLS LAST], [c@1 ASC NULLS LAST]],
has_header=true
@@ -3858,8 +3858,8 @@ ORDER BY row_n
logical_plan
01)Projection: amount_usd
02)--Sort: row_n ASC NULLS LAST
-03)----Projection: LAST_VALUE(l.d) ORDER BY [l.a ASC NULLS LAST] AS
amount_usd, row_n
-04)------Aggregate: groupBy=[[row_n]], aggr=[[LAST_VALUE(l.d) ORDER BY [l.a
ASC NULLS LAST]]]
+03)----Projection: last_value(l.d) ORDER BY [l.a ASC NULLS LAST] AS
amount_usd, row_n
+04)------Aggregate: groupBy=[[row_n]], aggr=[[last_value(l.d) ORDER BY [l.a
ASC NULLS LAST]]]
05)--------Projection: l.a, l.d, row_n
06)----------Inner Join: l.d = r.d Filter: CAST(l.a AS Int64) >= CAST(r.a AS
Int64) - Int64(10)
07)------------SubqueryAlias: l
@@ -3869,8 +3869,8 @@ logical_plan
11)----------------SubqueryAlias: r
12)------------------TableScan: multiple_ordered_table projection=[a, d]
physical_plan
-01)ProjectionExec: expr=[LAST_VALUE(l.d) ORDER BY [l.a ASC NULLS LAST]@1 as
amount_usd]
-02)--AggregateExec: mode=Single, gby=[row_n@2 as row_n], aggr=[LAST_VALUE(l.d)
ORDER BY [l.a ASC NULLS LAST]], ordering_mode=Sorted
+01)ProjectionExec: expr=[last_value(l.d) ORDER BY [l.a ASC NULLS LAST]@1 as
amount_usd]
+02)--AggregateExec: mode=Single, gby=[row_n@2 as row_n], aggr=[last_value(l.d)
ORDER BY [l.a ASC NULLS LAST]], ordering_mode=Sorted
03)----CoalesceBatchesExec: target_batch_size=2
04)------HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(d@1, d@1)],
filter=CAST(a@0 AS Int64) >= CAST(a@1 AS Int64) - 10, projection=[a@0, d@1,
row_n@4]
05)--------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/window_2.csv]]}, projection=[a, d],
output_ordering=[a@0 ASC NULLS LAST], has_header=true
diff --git a/datafusion/sqllogictest/test_files/joins.slt
b/datafusion/sqllogictest/test_files/joins.slt
index 0c45e3ffbf..ea71032556 100644
--- a/datafusion/sqllogictest/test_files/joins.slt
+++ b/datafusion/sqllogictest/test_files/joins.slt
@@ -3353,16 +3353,16 @@ ORDER BY l.a ASC NULLS FIRST;
----
logical_plan
01)Sort: l.a ASC NULLS FIRST
-02)--Projection: l.a, LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS FIRST] AS
last_col1
-03)----Aggregate: groupBy=[[l.a, l.b, l.c]], aggr=[[LAST_VALUE(r.b) ORDER BY
[r.a ASC NULLS FIRST]]]
+02)--Projection: l.a, last_value(r.b) ORDER BY [r.a ASC NULLS FIRST] AS
last_col1
+03)----Aggregate: groupBy=[[l.a, l.b, l.c]], aggr=[[last_value(r.b) ORDER BY
[r.a ASC NULLS FIRST]]]
04)------Inner Join: l.a = r.a
05)--------SubqueryAlias: l
06)----------TableScan: annotated_data projection=[a, b, c]
07)--------SubqueryAlias: r
08)----------TableScan: annotated_data projection=[a, b]
physical_plan
-01)ProjectionExec: expr=[a@0 as a, LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS
FIRST]@3 as last_col1]
-02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b, c@2 as c],
aggr=[LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS FIRST]],
ordering_mode=PartiallySorted([0])
+01)ProjectionExec: expr=[a@0 as a, last_value(r.b) ORDER BY [r.a ASC NULLS
FIRST]@3 as last_col1]
+02)--AggregateExec: mode=Single, gby=[a@0 as a, b@1 as b, c@2 as c],
aggr=[last_value(r.b) ORDER BY [r.a ASC NULLS FIRST]],
ordering_mode=PartiallySorted([0])
03)----CoalesceBatchesExec: target_batch_size=2
04)------HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(a@0, a@0)]
05)--------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/window_2.csv]]}, projection=[a, b,
c], output_ordering=[a@0 ASC, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST],
has_header=true
@@ -3398,8 +3398,8 @@ ORDER BY row_n
logical_plan
01)Projection: amount_usd
02)--Sort: row_n ASC NULLS LAST
-03)----Projection: LAST_VALUE(l.d) ORDER BY [l.a ASC NULLS LAST] AS
amount_usd, row_n
-04)------Aggregate: groupBy=[[row_n]], aggr=[[LAST_VALUE(l.d) ORDER BY [l.a
ASC NULLS LAST]]]
+03)----Projection: last_value(l.d) ORDER BY [l.a ASC NULLS LAST] AS
amount_usd, row_n
+04)------Aggregate: groupBy=[[row_n]], aggr=[[last_value(l.d) ORDER BY [l.a
ASC NULLS LAST]]]
05)--------Projection: l.a, l.d, row_n
06)----------Inner Join: l.d = r.d Filter: CAST(l.a AS Int64) >= CAST(r.a AS
Int64) - Int64(10)
07)------------SubqueryAlias: l
@@ -3409,8 +3409,8 @@ logical_plan
11)----------------SubqueryAlias: r
12)------------------TableScan: multiple_ordered_table projection=[a, d]
physical_plan
-01)ProjectionExec: expr=[LAST_VALUE(l.d) ORDER BY [l.a ASC NULLS LAST]@1 as
amount_usd]
-02)--AggregateExec: mode=Single, gby=[row_n@2 as row_n], aggr=[LAST_VALUE(l.d)
ORDER BY [l.a ASC NULLS LAST]], ordering_mode=Sorted
+01)ProjectionExec: expr=[last_value(l.d) ORDER BY [l.a ASC NULLS LAST]@1 as
amount_usd]
+02)--AggregateExec: mode=Single, gby=[row_n@2 as row_n], aggr=[last_value(l.d)
ORDER BY [l.a ASC NULLS LAST]], ordering_mode=Sorted
03)----CoalesceBatchesExec: target_batch_size=2
04)------HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(d@1, d@1)],
filter=CAST(a@0 AS Int64) >= CAST(a@1 AS Int64) - 10, projection=[a@0, d@1,
row_n@4]
05)--------CsvExec: file_groups={1 group:
[[WORKSPACE_ROOT/datafusion/core/tests/data/window_2.csv]]}, projection=[a, d],
output_ordering=[a@0 ASC NULLS LAST], has_header=true
@@ -3436,8 +3436,8 @@ ORDER BY l.a ASC NULLS FIRST;
----
logical_plan
01)Sort: l.a ASC NULLS FIRST
-02)--Projection: l.a, LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS FIRST] AS
last_col1
-03)----Aggregate: groupBy=[[l.a, l.b, l.c]], aggr=[[LAST_VALUE(r.b) ORDER BY
[r.a ASC NULLS FIRST]]]
+02)--Projection: l.a, last_value(r.b) ORDER BY [r.a ASC NULLS FIRST] AS
last_col1
+03)----Aggregate: groupBy=[[l.a, l.b, l.c]], aggr=[[last_value(r.b) ORDER BY
[r.a ASC NULLS FIRST]]]
04)------Inner Join: l.a = r.a
05)--------SubqueryAlias: l
06)----------TableScan: annotated_data projection=[a, b, c]
@@ -3446,11 +3446,11 @@ logical_plan
physical_plan
01)SortPreservingMergeExec: [a@0 ASC]
02)--SortExec: expr=[a@0 ASC], preserve_partitioning=[true]
-03)----ProjectionExec: expr=[a@0 as a, LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS
FIRST]@3 as last_col1]
-04)------AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as
c], aggr=[LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS FIRST]]
+03)----ProjectionExec: expr=[a@0 as a, last_value(r.b) ORDER BY [r.a ASC NULLS
FIRST]@3 as last_col1]
+04)------AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as
c], aggr=[last_value(r.b) ORDER BY [r.a ASC NULLS FIRST]]
05)--------CoalesceBatchesExec: target_batch_size=2
06)----------RepartitionExec: partitioning=Hash([a@0, b@1, c@2], 2),
input_partitions=2
-07)------------AggregateExec: mode=Partial, gby=[a@0 as a, b@1 as b, c@2 as
c], aggr=[LAST_VALUE(r.b) ORDER BY [r.a ASC NULLS FIRST]]
+07)------------AggregateExec: mode=Partial, gby=[a@0 as a, b@1 as b, c@2 as
c], aggr=[last_value(r.b) ORDER BY [r.a ASC NULLS FIRST]]
08)--------------CoalesceBatchesExec: target_batch_size=2
09)----------------HashJoinExec: mode=Partitioned, join_type=Inner, on=[(a@0,
a@0)]
10)------------------CoalesceBatchesExec: target_batch_size=2
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]