Skip to content

Commit

Permalink
test: Port (last) repartition.rs query to sqllogictest (#8936)
Browse files Browse the repository at this point in the history
* Migrate last repartition query

* Add reference to issue

Co-authored-by: Andrew Lamb <[email protected]>

* Fix missing statement

---------

Co-authored-by: Andrew Lamb <[email protected]>
  • Loading branch information
simicd and alamb authored Jan 25, 2024
1 parent fa65c68 commit 6e4abf5
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 60 deletions.
1 change: 0 additions & 1 deletion datafusion/core/tests/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ pub mod create_drop;
pub mod explain_analyze;
pub mod expr;
pub mod joins;
pub mod repartition;
pub mod select;
mod sql_api;

Expand Down
59 changes: 0 additions & 59 deletions datafusion/core/tests/sql/repartition.rs

This file was deleted.

56 changes: 56 additions & 0 deletions datafusion/sqllogictest/test_files/repartition.slt
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,59 @@ AggregateExec: mode=FinalPartitioned, gby=[column1@0 as column1], aggr=[SUM(parq
# Cleanup
statement ok
DROP TABLE parquet_table;



# Unbounded repartition
# See https://github.com/apache/arrow-datafusion/issues/5278
# Set up unbounded table and run a query - the query plan should display a `RepartitionExec`
# and a `CoalescePartitionsExec`
statement ok
CREATE UNBOUNDED EXTERNAL TABLE sink_table (
c1 VARCHAR NOT NULL,
c2 TINYINT NOT NULL,
c3 SMALLINT NOT NULL,
c4 SMALLINT NOT NULL,
c5 INTEGER NOT NULL,
c6 BIGINT NOT NULL,
c7 SMALLINT NOT NULL,
c8 INT NOT NULL,
c9 INT UNSIGNED NOT NULL,
c10 BIGINT UNSIGNED NOT NULL,
c11 FLOAT NOT NULL,
c12 DOUBLE NOT NULL,
c13 VARCHAR NOT NULL
)
STORED AS CSV
WITH HEADER ROW
LOCATION '../../testing/data/csv/aggregate_test_100.csv';

query TII
SELECT c1, c2, c3 FROM sink_table WHERE c3 > 0 LIMIT 5;
----
c 2 1
b 1 29
e 3 104
a 3 13
d 1 38

statement ok
set datafusion.execution.target_partitions = 3;

statement ok
set datafusion.optimizer.enable_round_robin_repartition = true;

query TT
EXPLAIN SELECT c1, c2, c3 FROM sink_table WHERE c3 > 0 LIMIT 5;
----
logical_plan
Limit: skip=0, fetch=5
--Filter: sink_table.c3 > Int16(0)
----TableScan: sink_table projection=[c1, c2, c3]
physical_plan
GlobalLimitExec: skip=0, fetch=5
--CoalescePartitionsExec
----CoalesceBatchesExec: target_batch_size=8192
------FilterExec: c3@2 > 0
--------RepartitionExec: partitioning=RoundRobinBatch(3), input_partitions=1
----------StreamingTableExec: partition_sizes=1, projection=[c1, c2, c3], infinite_source=true

0 comments on commit 6e4abf5

Please sign in to comment.