Skip to content

Port tests in json.rs to sqllogictest #6314

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 1 commit into from
May 10, 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
99 changes: 0 additions & 99 deletions datafusion/core/tests/sql/json.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 @@ -88,7 +88,6 @@ pub mod expr;
pub mod functions;
pub mod group_by;
pub mod joins;
pub mod json;
pub mod limit;
pub mod order;
pub mod parquet;
Expand Down
68 changes: 68 additions & 0 deletions datafusion/core/tests/sqllogictests/test_files/json.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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.

##########
## Json Tests
##########

statement ok
CREATE EXTERNAL TABLE json_test
STORED AS JSON
LOCATION 'tests/data/2.json';

statement ok
CREATE EXTERNAL TABLE single_nan
STORED AS JSON
LOCATION 'tests/data/3.json';

query IR rowsort
SELECT a, b FROM json_test
----
-10 -3.5
1 -3.5
1 0.6
1 0.6
1 2
1 2
1 2
1 2
100000000000000 0.6
2 0.6
5 -3.5
7 -3.5

query TT
EXPLAIN SELECT count(*) from json_test
----
logical_plan
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]
TableScan: json_test projection=[a]
physical_plan
AggregateExec: mode=Final, gby=[], aggr=[COUNT(UInt8(1))]
CoalescePartitionsExec
AggregateExec: mode=Partial, gby=[], aggr=[COUNT(UInt8(1))]
RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
JsonExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/2.json]]}, projection=[a]

query error DataFusion error: Schema error: No field named mycol\.
SELECT mycol FROM single_nan

statement ok
DROP TABLE json_test

statement ok
DROP TABLE single_nan