To not miss the forest for the trees - a holistic approach for explaining missing answers over nested data (extended version)

Ralf Diestelkämper, Seokki Lee, Melanie Herschel, Boris Glavic

Abstract

Query-based explanations for missing answers identify which operators of a query are responsible for the failure to return a missing answer of interest. This type of explanation has proven useful in debugging complex analytical queries, which are frequent in big data systems such as Apache Spark. We present a novel approach for producing query-based explanations that is the first to support nested data and to consider operators that modify the schema and structure of the data (e.g., nesting and projections) as potential causes. To efficiently compute explanations, we propose a heuristic algorithm that applies two novel techniques: reasoning about multiple schema alternatives and re-validating intermediate results. Our Spark-based implementation demonstrates scalability to large datasets and identifies explanations that existing techniques fail to find.

Introduction

In modern big data environments, data scientists frequently encounter the "why-not" problem: a complex analytical query fails to return an expected result. Traditional debugging involves manually sifting through massive intermediate datasets, a tedious and error-prone process. While existing tools attempt to automate this by identifying "guilty" operators, they typically suffer from two major gaps: a bias toward flat relational tables and a focus solely on filtering predicates. This paper introduces a holistic framework that accounts for the nested structures (like JSON or Spark DataFrames) common in modern systems and treats structural operators as first-class potential causes for missing data.

The Challenge of Nested Data

Existing "why-not" explanation tools often blame "picky" filters (e.g., price > 100). However, in nested environments, a result might be missing because a user flattened the wrong array or projected the wrong attribute. These structural mistakes are invisible to tools that only look at predicates.

Example of nested input data and a query pipeline involving structural operators like Flatten and Nesting.

As shown in the figure above, a query pipeline over nested data involves complex transformations. If the Flatten operator targets the wrong address field, the expected output will never appear, regardless of how the subsequent filters are tuned.

The core of this approach is formalizing the problem using Reparameterizations (RPs). Instead of merely identifying a failing operator, the system searches for how to change an operator's parameters—such as adjusting a filter constant or swapping a projected attribute—to make the missing answer appear. The goal is to find Minimal Successful Reparameterizations (MSRs): the smallest set of changes that "repairs" the query with the fewest unintended side effects on existing correct results.

To make this computationally feasible on big data, the authors propose a four-step heuristic algorithm:

  1. Schema Backtracing: Determining what the input data should have looked like based on the missing result.
  2. Schema Alternatives (SAs): Identifying potential alternative attributes that could have been used (e.g., confusing home_address with work_address).
  3. Data Tracing: Instrumenting the query on Spark to track "compatible" tuples through every operator, re-validating at each step to ensure they can contribute to the missing answer.
  4. MSR Computation: Using traced metadata to rank and return the most likely explanations.
Tree-based representations of query results (T1, T2, T3) under different reparameterizations.

Evaluation and Key Results

The system was evaluated using three large-scale nested datasets (DBLP, Twitter, and TPC-H Nested) ranging from 100GB to 500GB.

  • Superior Quality: In head-to-head comparisons with existing tools like WN++, this approach found correct explanations in scenarios where others failed, specifically when the error was structural.
  • Linear Scalability: By leveraging Spark’s native distributed execution for provenance annotations, the tool scales linearly with data size. While tracing overhead exists, it remains practical for debugging tasks that would otherwise take hours of manual labor.
  • Schema Flexibility: The "Schema Alternatives" feature correctly identified instances where users confused similar attributes (e.g., discount vs. tax), a common human error in complex schemas.

Conclusion

By treating structural operators as potential roots of error, this framework provides a more complete and scalable solution for debugging modern analytical queries. While future work will address more complex join types and aggregation function reparameterization, this holistic approach represents a significant advancement in automated data debugging for nested systems.

Summary updated

BibTeX
@inproceedings{diestelkamper2021not,
  author = {Ralf Diestelkämper and Seokki Lee and Melanie Herschel and Boris Glavic},
  title = {{To not miss the forest for the trees - a holistic approach for explaining missing answers over nested data (extended version)}},
  booktitle = {SIGMOD},
  year = {2021},
  doi = {10.1145/3448016.3457249},
}
Figure