Skip to content

Commit 77cb4ba

Browse files
committed
fuzz
1 parent fc42ab8 commit 77cb4ba

7 files changed

Lines changed: 427 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ members = [
3131
"src/meta/store",
3232
"src/meta/ver",
3333
"src/query/codegen",
34+
"src/query/expression/fuzz",
3435
"src/tests/planner_replay",
3536
"tests/sqllogictests",
3637
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
artifacts
2+
corpus
3+
coverage
4+
target
5+
6+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "databend-expression-domain-fuzz"
3+
version = "0.0.0"
4+
publish = false
5+
edition = "2024"
6+
7+
[package.metadata]
8+
cargo-fuzz = true
9+
10+
[dependencies]
11+
arbitrary = "1.4"
12+
databend-common-column = { path = "../../../common/column" }
13+
databend-common-expression = { path = ".." }
14+
libfuzzer-sys = "0.4"
15+
16+
[lib]
17+
doctest = false
18+
19+
[[bin]]
20+
name = "column_domain"
21+
path = "fuzz_targets/column_domain.rs"
22+
test = false
23+
doc = false
24+
bench = false
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2021 Datafuse Labs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#![no_main]
16+
17+
use databend_expression_domain_fuzz::ColumnCase;
18+
use databend_expression_domain_fuzz::run_column_case;
19+
use libfuzzer_sys::fuzz_target;
20+
21+
// This target validates the fundamental `Column::domain` invariant: every value physically present
22+
// in a generated column must be contained by the domain returned for that column.
23+
24+
// The typed `Arbitrary` generator covers empty and NULL columns, all number and decimal widths,
25+
// Boolean, String, temporal and interval columns, Binary, and recursive Nullable, Array, Map, and
26+
// Tuple shapes. Array and Map offsets may start above zero so sliced-column behavior is exercised as
27+
// well.
28+
29+
// For every row, the oracle recursively checks the actual scalar value against the column domain.
30+
// Nullable checks NULL membership, Array and Map check their real elements, and Tuple checks each
31+
// field. Primitive values use singleton-domain containment. Undefined domains accept unsupported
32+
// scalar types by definition.
33+
//
34+
// cargo fuzz run --dev --sanitizer none --strip-dead-code column_domain -- -runs=10000 -max_len=4096
35+
fuzz_target!(|case: ColumnCase| run_column_case(case));

0 commit comments

Comments
 (0)