Skip to content

Commit 7d1f09b

Browse files
Add crate for sqllogictest. (#827)
1 parent c8f5d91 commit 7d1f09b

File tree

5 files changed

+132
-0
lines changed

5 files changed

+132
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ members = [
2323
"crates/iceberg",
2424
"crates/integration_tests",
2525
"crates/integrations/*",
26+
"crates/sqllogictest",
2627
"crates/test_utils",
2728
]
2829
exclude = ["bindings/python"]

crates/sqllogictest/Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[package]
19+
name = "sqllogictest"
20+
version = { workspace = true }
21+
edition = { workspace = true }
22+
homepage = { workspace = true }
23+
repository = { workspace = true }
24+
license = { workspace = true }
25+
rust-version = { workspace = true }
26+
27+
[dependencies]
28+
anyhow = { workspace = true }

crates/sqllogictest/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one
3+
~ or more contributor license agreements. See the NOTICE file
4+
~ distributed with this work for additional information
5+
~ regarding copyright ownership. The ASF licenses this file
6+
~ to you under the Apache License, Version 2.0 (the
7+
~ "License"); you may not use this file except in compliance
8+
~ with the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing,
13+
~ software distributed under the License is distributed on an
14+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
~ KIND, either express or implied. See the License for the
16+
~ specific language governing permissions and limitations
17+
~ under the License.
18+
-->
19+
20+
This crate contains a suite of [sqllogictest](https://crates.io/crates/sqllogictest) tests that are used to validate [iceberg-rust](https://github.com/apache/iceberg-rust).
21+
22+
## Running the tests
23+
24+
Just run the following command:
25+
26+
```bash
27+
cargo test
28+
```
29+
30+
## Sql Engines
31+
32+
The tests are run against the following sql engines:
33+
34+
* [Apache datafusion](https://crates.io/crates/datafusion)
35+
* [Apache spark](https://github.com/apache/spark)

crates/sqllogictest/src/error.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
use std::fmt::{Debug, Display, Formatter};
19+
20+
pub struct Error(pub anyhow::Error);
21+
22+
pub type Result<T> = std::result::Result<T, Error>;
23+
24+
impl Debug for Error {
25+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
26+
write!(f, "{:?}", self.0)
27+
}
28+
}
29+
30+
impl Display for Error {
31+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
32+
write!(f, "{}", self.0)
33+
}
34+
}
35+
36+
impl std::error::Error for Error {
37+
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
38+
self.0.source()
39+
}
40+
}
41+
42+
impl From<anyhow::Error> for Error {
43+
fn from(value: anyhow::Error) -> Self {
44+
Self(value)
45+
}
46+
}

crates/sqllogictest/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
// This lib contains codes copied from
19+
// [Apache Datafusion](https://github.com/apache/datafusion/tree/main/datafusion/sqllogictest)
20+
21+
#[allow(dead_code)]
22+
mod error;

0 commit comments

Comments
 (0)