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.
Adding Constant Check for FilterExec (apache#9649)
* fix bugs in adding extra SortExec * adding tests * optimize code * Update datafusion/physical-plan/src/filter.rs Co-authored-by: Mustafa Akur <[email protected]> * optimize code * optimize code * optimize code * optimize code * fix clippy --------- Co-authored-by: Mustafa Akur <[email protected]>
- Loading branch information
1 parent
269563a
commit eb13f59
Showing
2 changed files
with
87 additions
and
1 deletion.
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
61 changes: 61 additions & 0 deletions
61
datafusion/sqllogictest/test_files/filter_without_sort_exec.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,61 @@ | ||
# 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 table | ||
statement ok | ||
CREATE UNBOUNDED EXTERNAL TABLE data ( | ||
"date" VARCHAR, | ||
"ticker" VARCHAR, | ||
"time" VARCHAR, | ||
) STORED AS CSV | ||
WITH ORDER ("date", "ticker", "time") | ||
LOCATION './a.parquet'; | ||
|
||
|
||
# query | ||
query TT | ||
explain SELECT * FROM data | ||
WHERE ticker = 'A' | ||
ORDER BY "date", "time"; | ||
---- | ||
logical_plan | ||
Sort: data.date ASC NULLS LAST, data.time ASC NULLS LAST | ||
--Filter: data.ticker = Utf8("A") | ||
----TableScan: data projection=[date, ticker, time] | ||
physical_plan | ||
SortPreservingMergeExec: [date@0 ASC NULLS LAST,time@2 ASC NULLS LAST] | ||
--CoalesceBatchesExec: target_batch_size=8192 | ||
----FilterExec: ticker@1 = A | ||
------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 | ||
--------StreamingTableExec: partition_sizes=1, projection=[date, ticker, time], infinite_source=true, output_ordering=[date@0 ASC NULLS LAST, ticker@1 ASC NULLS LAST, time@2 ASC NULLS LAST] | ||
|
||
# query | ||
query TT | ||
explain SELECT * FROM data | ||
WHERE date = 'A' | ||
ORDER BY "ticker", "time"; | ||
---- | ||
logical_plan | ||
Sort: data.ticker ASC NULLS LAST, data.time ASC NULLS LAST | ||
--Filter: data.date = Utf8("A") | ||
----TableScan: data projection=[date, ticker, time] | ||
physical_plan | ||
SortPreservingMergeExec: [ticker@1 ASC NULLS LAST,time@2 ASC NULLS LAST] | ||
--CoalesceBatchesExec: target_batch_size=8192 | ||
----FilterExec: date@0 = A | ||
------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1 | ||
--------StreamingTableExec: partition_sizes=1, projection=[date, ticker, time], infinite_source=true, output_ordering=[date@0 ASC NULLS LAST, ticker@1 ASC NULLS LAST, time@2 ASC NULLS LAST] |