apache / apache/druid

OvershadowableManager.isComplete() looks buggy

Open
#8,788 2 comments 0 reactions 0 assignees View on GitHub
Area - Metadata Contributions Welcome Improvement
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

The current implementation of `OvershadowableManager.isComplete()`:
https://github.com/apache/incubator-druid/blob/a95e3d438e676310522a68c74a43d99f5f0492d5/core/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java#L891-L894

looks buggy because it might throw an exception when any value in `visibleGroup` is a map with more than one element. If there are never more than one element in this map, why this is a map, not just a single value?

It might be this this is not a bug because there are some invisible contract between callers to `OvershadowableManager.isComplete()` and `OvershadowableManager` which guarantee that when `isComplete()` is called all values in `visibleGroup` are maps of at most one value. But such a contract would need to be expressed explicitly in comments, at least. (Not to say that it is very fragile design and should preferably be avoided).

FYI @jihoonson

Contributor guide

Open the contributing guide

Research direction

Start in core/src/main/java/org/apache/druid/timeline/partition/OvershadowableManager.java at isComplete() around lines 891-894, then inspect its callers and how visibleGroup is populated. Determine whether values with multiple map elements are valid and whether an explicit invariant exists. Done means resolving the possible exception with a documented contract or an implementation change, supported by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.