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
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ public <E extends Expression> List<E> normalizeToUseSlotRef(Collection<E> expres
NormalizeToSlotTriplet normalizeToSlotTriplet = normalizeToSlotMap.get(child);
return normalizeToSlotTriplet == null ? child : normalizeToSlotTriplet.remainExpr;
});
if (rewriteExpr instanceof Alias) {
Alias alias = (Alias) rewriteExpr;
if (alias.child() instanceof SlotReference
&& alias.getExprId().equals(((SlotReference) alias.child()).getExprId())) {
// alias k1#1 as k1#1 --> k1#1
rewriteExpr = alias.child();
}
}
result.add((E) rewriteExpr);
}
return result.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testSimpleWindowFunction() {
).when(project -> {
List<NamedExpression> projects = project.getProjects();
return projects.get(0).equals(id)
&& projects.get(1) instanceof Alias;
&& projects.get(1) instanceof SlotReference && projects.get(1).equals(windowAlias.toSlot());
})
);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public void testComplexWindowFunction() {
).when(project -> {
List<NamedExpression> projects = project.getProjects();
return projects.get(0) instanceof SlotReference
&& projects.get(1) instanceof Alias;
&& projects.get(1) instanceof SlotReference && projects.get(1).equals(windowAlias.toSlot());
})
);
}
Expand Down Expand Up @@ -226,8 +226,7 @@ public void testComplexWindowFunctionTogetherWithAggregateFunction() {
List<NamedExpression> projects = project.getProjects();
return projects.get(0).equals(gender)
&& projects.get(1) instanceof SlotReference
&& projects.get(2) instanceof Alias
&& projects.get(2).child(0) instanceof SlotReference;
&& projects.get(2) instanceof SlotReference && projects.get(2).equals(windowAlias.toSlot());
})
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !multi_column_predicate_push_down_window_shape --
PhysicalResultSink
--filter((num <= 2))
--filter((t.num <= 2))
----PhysicalWindow
------PhysicalQuickSort[LOCAL_SORT]
--------PhysicalPartitionTopN
Expand All @@ -15,7 +15,7 @@ PhysicalResultSink

-- !multi_column_or_predicate_push_down_window_shape --
PhysicalResultSink
--filter((rc < 2))
--filter((t.rc < 2))
----PhysicalWindow
------PhysicalQuickSort[LOCAL_SORT]
--------PhysicalPartitionTopN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-- !shape_1 --
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----filter((rn <= 2))
----filter((T.rn <= 2))
------PhysicalWindow
--------PhysicalQuickSort[LOCAL_SORT]
----------PhysicalPartitionTopN
Expand All @@ -22,7 +22,7 @@ PhysicalResultSink
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----PhysicalProject
------filter((rn <= 2))
------filter((T.rn <= 2))
--------PhysicalWindow
----------PhysicalQuickSort[LOCAL_SORT]
------------PhysicalPartitionTopN
Expand All @@ -32,7 +32,7 @@ PhysicalResultSink
-- !3 --
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----filter((T.b = 2) and (rn <= 2))
----filter((T.b = 2) and (T.rn <= 2))
------PhysicalWindow
--------PhysicalQuickSort[LOCAL_SORT]
----------PhysicalPartitionTopN
Expand All @@ -42,7 +42,7 @@ PhysicalResultSink
PhysicalResultSink
--PhysicalDistribute[DistributionSpecGather]
----PhysicalProject
------filter((T.b = 2) and (rn <= 2))
------filter((T.b = 2) and (T.rn <= 2))
--------PhysicalWindow
----------PhysicalQuickSort[LOCAL_SORT]
------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF1
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V11.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down Expand Up @@ -46,7 +46,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF0
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V21.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -48,7 +48,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -80,7 +80,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PhysicalResultSink
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------PhysicalProject
----------filter((web_cumulative > store_cumulative))
----------filter((y.web_cumulative > y.store_cumulative))
------------PhysicalWindow
--------------PhysicalQuickSort[LOCAL_SORT]
----------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PhysicalResultSink
--PhysicalTopN[MERGE_SORT]
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------filter((rk <= 100))
--------filter((dw2.rk <= 100))
----------PhysicalWindow
------------PhysicalPartitionTopN
--------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF1
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V11.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down Expand Up @@ -46,7 +46,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF0
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V21.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF1
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V11.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down Expand Up @@ -46,7 +46,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF0
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V21.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -48,7 +48,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -80,7 +80,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PhysicalResultSink
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------PhysicalProject
----------filter((web_cumulative > store_cumulative))
----------filter((y.web_cumulative > y.store_cumulative))
------------PhysicalWindow
--------------PhysicalQuickSort[LOCAL_SORT]
----------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PhysicalResultSink
--PhysicalTopN[MERGE_SORT]
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------filter((rk <= 100))
--------filter((dw2.rk <= 100))
----------PhysicalWindow
------------PhysicalPartitionTopN
--------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PhysicalResultSink
--------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------filter((rnk < 11))
--------------------------filter((V11.rnk < 11))
----------------------------PhysicalWindow
------------------------------PhysicalQuickSort[MERGE_SORT]
--------------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down Expand Up @@ -45,7 +45,7 @@ PhysicalResultSink
--------------------------------------------------------------PhysicalOlapScan[store_sales]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------filter((rnk < 11))
--------------------------filter((V21.rnk < 11))
----------------------------PhysicalWindow
------------------------------PhysicalQuickSort[MERGE_SORT]
--------------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -49,7 +49,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -82,7 +82,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PhysicalResultSink
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------PhysicalProject
----------filter((web_cumulative > store_cumulative))
----------filter((y.web_cumulative > y.store_cumulative))
------------PhysicalWindow
--------------PhysicalQuickSort[LOCAL_SORT]
----------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PhysicalResultSink
--PhysicalTopN[MERGE_SORT]
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------filter((rk <= 100))
--------filter((dw2.rk <= 100))
----------PhysicalWindow
------------PhysicalQuickSort[LOCAL_SORT]
--------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PhysicalResultSink
--------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=()
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------filter((rnk < 11))
--------------------------filter((V11.rnk < 11))
----------------------------PhysicalWindow
------------------------------PhysicalQuickSort[MERGE_SORT]
--------------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down Expand Up @@ -45,7 +45,7 @@ PhysicalResultSink
--------------------------------------------------------------PhysicalOlapScan[store_sales]
----------------------PhysicalDistribute[DistributionSpecHash]
------------------------PhysicalProject
--------------------------filter((rnk < 11))
--------------------------filter((V21.rnk < 11))
----------------------------PhysicalWindow
------------------------------PhysicalQuickSort[MERGE_SORT]
--------------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -49,7 +49,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down Expand Up @@ -82,7 +82,7 @@ PhysicalResultSink
--------------------------PhysicalDistribute[DistributionSpecHash]
----------------------------hashAgg[LOCAL]
------------------------------PhysicalProject
--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10)))
--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10)))
----------------------------------PhysicalWindow
------------------------------------PhysicalQuickSort[LOCAL_SORT]
--------------------------------------PhysicalWindow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PhysicalResultSink
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------PhysicalProject
----------filter((web_cumulative > store_cumulative))
----------filter((y.web_cumulative > y.store_cumulative))
------------PhysicalWindow
--------------PhysicalQuickSort[LOCAL_SORT]
----------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PhysicalResultSink
--PhysicalTopN[MERGE_SORT]
----PhysicalDistribute[DistributionSpecGather]
------PhysicalTopN[LOCAL_SORT]
--------filter((rk <= 100))
--------filter((dw2.rk <= 100))
----------PhysicalWindow
------------PhysicalQuickSort[LOCAL_SORT]
--------------PhysicalDistribute[DistributionSpecHash]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF1
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V11.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down Expand Up @@ -46,7 +46,7 @@ PhysicalResultSink
--------------------PhysicalOlapScan[item] apply RFs: RF0
------------------PhysicalDistribute[DistributionSpecHash]
--------------------PhysicalProject
----------------------filter((rnk < 11))
----------------------filter((V21.rnk < 11))
------------------------PhysicalWindow
--------------------------PhysicalQuickSort[MERGE_SORT]
----------------------------PhysicalDistribute[DistributionSpecGather]
Expand Down
Loading