forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue apache#8838 discard extra sort when sorted element is wrap…
…ped (apache#9127) * fix: issue apache#8838 discard extra sort when sorted element is wrapped fix: issue apache#8838 discard extra sort when sorted element is wrapped fix: issue apache#8838 discard extra sort when sorted element is wrapped * fix bugs * fix bugs * fix bugs * fix:bugs * adding tests * adding cast UTF8 type and diable scalarfunction situation * fix typo
- Loading branch information
Showing
4 changed files
with
209 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
datafusion/sqllogictest/test_files/monotonic_projection_test.slt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# prepare the table | ||
statement ok | ||
CREATE EXTERNAL TABLE delta_encoding_required_column ( | ||
c_customer_sk INT NOT NULL, | ||
c_current_cdemo_sk INT NOT NULL | ||
) | ||
STORED AS CSV | ||
WITH ORDER ( | ||
c_customer_sk DESC, | ||
c_current_cdemo_sk DESC | ||
) | ||
LOCATION '../../testing/data/csv/aggregate_test_100.csv'; | ||
|
||
# test for substitute CAST senario | ||
query TT | ||
EXPLAIN | ||
SELECT | ||
CAST(c_customer_sk AS BIGINT) AS c_customer_sk_big, | ||
c_current_cdemo_sk | ||
FROM delta_encoding_required_column | ||
ORDER BY c_customer_sk_big DESC, c_current_cdemo_sk DESC; | ||
---- | ||
logical_plan | ||
Sort: c_customer_sk_big DESC NULLS FIRST, delta_encoding_required_column.c_current_cdemo_sk DESC NULLS FIRST | ||
--Projection: CAST(delta_encoding_required_column.c_customer_sk AS Int64) AS c_customer_sk_big, delta_encoding_required_column.c_current_cdemo_sk | ||
----TableScan: delta_encoding_required_column projection=[c_customer_sk, c_current_cdemo_sk] | ||
physical_plan | ||
SortPreservingMergeExec: [c_customer_sk_big@0 DESC,c_current_cdemo_sk@1 DESC] | ||
--ProjectionExec: expr=[CAST(c_customer_sk@0 AS Int64) as c_customer_sk_big, c_current_cdemo_sk@1 as c_current_cdemo_sk] | ||
----RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 | ||
------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c_customer_sk, c_current_cdemo_sk], output_ordering=[c_customer_sk@0 DESC, c_current_cdemo_sk@1 DESC], has_header=false | ||
|
||
# test for commom rename | ||
query TT | ||
EXPLAIN | ||
SELECT | ||
c_customer_sk AS c_customer_sk_big, | ||
c_current_cdemo_sk | ||
FROM delta_encoding_required_column | ||
ORDER BY c_customer_sk_big DESC, c_current_cdemo_sk DESC; | ||
---- | ||
logical_plan | ||
Sort: c_customer_sk_big DESC NULLS FIRST, delta_encoding_required_column.c_current_cdemo_sk DESC NULLS FIRST | ||
--Projection: delta_encoding_required_column.c_customer_sk AS c_customer_sk_big, delta_encoding_required_column.c_current_cdemo_sk | ||
----TableScan: delta_encoding_required_column projection=[c_customer_sk, c_current_cdemo_sk] | ||
physical_plan | ||
ProjectionExec: expr=[c_customer_sk@0 as c_customer_sk_big, c_current_cdemo_sk@1 as c_current_cdemo_sk] | ||
--CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c_customer_sk, c_current_cdemo_sk], output_ordering=[c_customer_sk@0 DESC, c_current_cdemo_sk@1 DESC], has_header=false | ||
|
||
|
||
# test for cast Utf8 | ||
query TT | ||
EXPLAIN | ||
SELECT | ||
CAST(c_customer_sk AS STRING) AS c_customer_sk_big, | ||
c_current_cdemo_sk | ||
FROM delta_encoding_required_column | ||
ORDER BY c_customer_sk_big DESC, c_current_cdemo_sk DESC; | ||
---- | ||
logical_plan | ||
Sort: c_customer_sk_big DESC NULLS FIRST, delta_encoding_required_column.c_current_cdemo_sk DESC NULLS FIRST | ||
--Projection: CAST(delta_encoding_required_column.c_customer_sk AS Utf8) AS c_customer_sk_big, delta_encoding_required_column.c_current_cdemo_sk | ||
----TableScan: delta_encoding_required_column projection=[c_customer_sk, c_current_cdemo_sk] | ||
physical_plan | ||
SortPreservingMergeExec: [c_customer_sk_big@0 DESC,c_current_cdemo_sk@1 DESC] | ||
--SortExec: expr=[c_customer_sk_big@0 DESC,c_current_cdemo_sk@1 DESC] | ||
----ProjectionExec: expr=[CAST(c_customer_sk@0 AS Utf8) as c_customer_sk_big, c_current_cdemo_sk@1 as c_current_cdemo_sk] | ||
------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 | ||
--------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c_customer_sk, c_current_cdemo_sk], output_ordering=[c_customer_sk@0 DESC, c_current_cdemo_sk@1 DESC], has_header=false |