Skip to content

Port tests in identifiers.rs to sqllogictest #6245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 5, 2023
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
239 changes: 0 additions & 239 deletions datafusion/core/tests/sql/idenfifers.rs

This file was deleted.

1 change: 0 additions & 1 deletion datafusion/core/tests/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub mod wildcard;
pub mod window;

pub mod explain;
pub mod idenfifers;
pub mod information_schema;
pub mod parquet_schema;
pub mod partitioned_csv;
Expand Down
106 changes: 106 additions & 0 deletions datafusion/core/tests/sqllogictests/test_files/identifiers.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# 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.

statement ok
CREATE EXTERNAL TABLE case_insensitive_test (
a INT,
b INT,
c INT
)
STORED AS CSV
WITH HEADER ROW
LOCATION './tests/data/example.csv'

# normalized column identifiers
query II
SELECT A, b FROM case_insensitive_test
----
1 2

query II
SELECT t.A, b FROM case_insensitive_test AS t
----
1 2

query II
SELECT t.A as x, b FROM case_insensitive_test AS t
----
1 2

query II
SELECT t.A AS X, b FROM case_insensitive_test AS t
----
1 2


query II
SELECT t.A AS "X", b FROM case_insensitive_test AS t
----
1 2

query II
SELECT t.A AS x, b FROM case_insensitive_test AS t ORDER BY x
----
1 2

query II
SELECT t.A AS x, b FROM case_insensitive_test AS t ORDER BY X
----
1 2

query II
SELECT t.A AS "X", b FROM case_insensitive_test AS t ORDER BY "X"
----
1 2

query II
SELECT a, b FROM case_insensitive_test where A IS NOT null
----
1 2

query II
SELECT a as x, count(*) as c FROM case_insensitive_test GROUP BY X
----
1 1

query II
SELECT a as "X", count(*) as c FROM case_insensitive_test GROUP BY "X"
----
1 1

statement ok
drop table case_insensitive_test

# case insensitive in sql errors

statement ok
CREATE TABLE test("Column1" string) AS VALUES ('content1');

statement error DataFusion error: Schema error: No field named column1\. Valid fields are test\."Column1"\.
SELECT COLumn1 from test

statement error DataFusion error: Schema error: No field named column1\. Valid fields are test\."Column1"\.
SELECT Column1 from test

statement error DataFusion error: Schema error: No field named column1\. Valid fields are test\."Column1"\.
SELECT column1 from test

statement error DataFusion error: Schema error: No field named column1\. Valid fields are test\."Column1"\.
SELECT "column1" from test

statement ok
SELECT "Column1" from test