Skip to content

Commit

Permalink
Port tests in wildcard.rs to sqllogictest (apache#6249)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
masanobbb and alamb authored May 5, 2023
1 parent a446cdb commit 39ad9e8
Showing 3 changed files with 122 additions and 144 deletions.
1 change: 0 additions & 1 deletion datafusion/core/tests/sql/mod.rs
Original file line number Diff line number Diff line change
@@ -98,7 +98,6 @@ pub mod references;
pub mod select;
pub mod timestamp;
pub mod udf;
pub mod wildcard;
pub mod window;

pub mod explain;
143 changes: 0 additions & 143 deletions datafusion/core/tests/sql/wildcard.rs

This file was deleted.

122 changes: 122 additions & 0 deletions datafusion/core/tests/sqllogictests/test_files/wildcard.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# 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.


# create t1 table
statement ok
CREATE TABLE t1(t1_id INT, t1_name TEXT, t1_int INT) AS VALUES
(11, 'a', 1),
(22, 'b', 2),
(33, 'c', 3),
(44, 'd', 4);

# create t2 table
statement ok
CREATE TABLE t2(t2_id INT, t2_name TEXT, t2_int INT) AS VALUES
(11, 'z', 3),
(22, 'y', 1),
(44, 'x', 3),
(55, 'w', 3);

# create aggregate_simple table
statement ok
CREATE EXTERNAL TABLE aggregate_simple (
c1 REAL NOT NULL,
c2 DOUBLE NOT NULL,
c3 BOOLEAN NOT NULL,
)
STORED AS CSV
WITH HEADER ROW
LOCATION 'tests/data/aggregate_simple.csv'


##########
## Wildcard Tests
##########

# select_qualified_wildcard
query RRB nosort
SELECT agg.* FROM aggregate_simple as agg ORDER BY c1
----
0.00001 0.000000000001 true
0.00002 0.000000000002 false
0.00002 0.000000000002 false
0.00003 0.000000000003 true
0.00003 0.000000000003 true
0.00003 0.000000000003 true
0.00004 0.000000000004 false
0.00004 0.000000000004 false
0.00004 0.000000000004 false
0.00004 0.000000000004 false
0.00005 0.000000000005 true
0.00005 0.000000000005 true
0.00005 0.000000000005 true
0.00005 0.000000000005 true
0.00005 0.000000000005 true

# select_non_alias_qualified_wildcard
query RRB nosort
SELECT aggregate_simple.* FROM aggregate_simple ORDER BY c1
----
0.00001 0.000000000001 true
0.00002 0.000000000002 false
0.00002 0.000000000002 false
0.00003 0.000000000003 true
0.00003 0.000000000003 true
0.00003 0.000000000003 true
0.00004 0.000000000004 false
0.00004 0.000000000004 false
0.00004 0.000000000004 false
0.00004 0.000000000004 false
0.00005 0.000000000005 true
0.00005 0.000000000005 true
0.00005 0.000000000005 true
0.00005 0.000000000005 true
0.00005 0.000000000005 true

# select_qualified_wildcard_join
query ITIITI nosort
SELECT tb1.*, tb2.* FROM t1 tb1 JOIN t2 tb2 ON t2_id = t1_id ORDER BY t1_id
----
11 a 1 11 z 3
22 b 2 22 y 1
44 d 4 44 x 3

# select_non_alias_qualified_wildcard_join
query ITIITI nosort
SELECT t1.*, tb2.* FROM t1 JOIN t2 tb2 ON t2_id = t1_id ORDER BY t1_id
----
11 a 1 11 z 3
22 b 2 22 y 1
44 d 4 44 x 3

# select_wrong_qualified_wildcard
statement error Error during planning: Invalid qualifier agg
SELECT agg.* FROM aggregate_simple ORDER BY c1

########
# Clean up after the test
########

statement ok
DROP TABLE t1;

statement ok
DROP TABLE t2;

statement ok
DROP TABLE aggregate_simple;

0 comments on commit 39ad9e8

Please sign in to comment.