apache / apache/datafusion

Property based testing to detect more (subtle and edge cases) bugs

Open
#12,569 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

Property based testing is a testing technique that can be used to ensure a certain property holds for a certain set of input. For example the associative property of addition:

```math
$$
\forall a, b, c \in \mathbb{R} :\quad (a + b) + c = a + (b + c)
$$
```

Property based testing is often used to test soundness/correctness of certain properties in interpreters, compilers and static analysis tools. As an example, property based testing is used to test certain lattice properties in the following static analysis tool (written in Scala) https://github.com/Abdullahsab3/maf/blob/master/code/shared/src/test/scala/maf/test/lattice/LatticeTests.scala

It might be interesting to use it for Apache Datafusion as well? I think bugs such as https://github.com/apache/datafusion/issues/12190 can be detected easier when this kind of tests are present. It might help improve the stability of Datafusion in the long run.

In the context of Datafusion, on top of my head, I think it might be useful to use this technique to test arithmetic properties between scalar values, time values, etc. There are likely more advanced use cases for property based testing in Datafusion wrt logical or physical plans.

In Rust the popular property based testing libraries are proptest (great documentation https://proptest-rs.github.io/proptest/intro.html) and Quickcheck (https://github.com/BurntSushi/quickcheck). Not sure how easy or feasible it is to use this technique in Datafusion or Arrow. Just an idea to share

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing DataFusion's existing Rust test organization and the proptest and Quickcheck documentation linked in the issue. Consider which arithmetic or time-value properties are specific enough to test first; the issue does not name files, entry points, or a defined completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.