Abstract
Modern data lakes contain thousands of heterogeneous tables with inconsistent formatting, making join discovery a significant challenge. Traditional methods fail when data requires structural transformations, such as splitting or concatenating columns. We present QJoin, a reinforcement learning (RL) framework that models transformation search as a Markov Decision Process. By employing a uniqueness-aware reward and strategy reuse mechanisms, QJoin efficiently discovers complex joins across large-scale datasets. Our evaluation shows that QJoin achieves an average F1-score of 91.0%, outperforming existing automated tools and large language models while significantly reducing computation time through strategy reuse.
Introduction
In modern enterprise environments, data is often scattered across massive, heterogeneous "data lakes." Finding which tables can be joined is a critical first step for data integration and analysis, yet it remains a manual and error-prone task. Traditional "equi-join" methods require exact matches, and even "fuzzy joins" are limited to handling minor typographical errors.
These methods fail when data is structurally different. For instance, one table might use email addresses as unique identifiers, while another uses only the username portion. In other cases, names might be split across "First" and "Last" columns in one dataset but combined into a single "Full Name" field in another. Existing automated tools like AutoJoin attempt to find these transformations but are computationally expensive because they restart the search from scratch for every new pair of columns and struggle with multi-column combinations. QJoin addresses these limitations by treating transformation discovery as a learning problem.
The QJoin Framework
QJoin treats the search for the optimal sequence of data transformations (e.g., lowercase, strip, concatenate) as a reinforcement learning problem. The system follows a multi-stage pipeline designed for both accuracy and scalability.
RL-Based Discovery and Rewards
An RL agent explores chains of transformation operators where the "state" is the current version of the data and "actions" are the operators applied. A key innovation in QJoin is the uniqueness-aware reward function. If an agent optimizes solely for similarity, it might learn "degenerate" transformations—such as turning every value into a constant—to achieve a 100% match. QJoin balances similarity gains with a penalty for losing "key distinctiveness," ensuring the resulting join is semantically meaningful.
To provide smoother feedback to the agent, QJoin utilizes Adjusted Longest Continuous Substring (ALCS) rather than Jaccard similarity. ALCS provides monotonic feedback as the agent approaches a correct match, making the learning process more stable.
Efficiency via Strategy Reuse
QJoin exploits the "regularity of messiness" in data lakes. Data formats are rarely random; "Name" or "Date" columns across different departments often require identical cleanup steps. QJoin implements two speed-up mechanisms:
- Agent Transfer: Initializing a new agent's parameters using knowledge from an agent previously trained on a similar column cluster.
- Transformation Cache: Directly reusing successful operator sequences for similar column patterns, bypassing the RL search entirely.
Experimental Evaluation
We evaluated QJoin on three major benchmarks: the AutoJoin Web Benchmark (31 table pairs) and two massive real-world repositories: NYC Open Data (1,600+ tables) and Chicago Open Data (800+ tables).
Key Results
- Superior Accuracy: On the AutoJoin benchmark, QJoin achieved an average F1-score of 91.0%, outperforming the original AutoJoin (87.3%) and significantly beating LLM-based baselines like GPT-4o, which often failed to generate executable code.
- Efficiency Gains: The reuse mechanisms proved highly effective. On specific datasets, reuse cut runtime by up to 27%. In the combined NYC and Chicago repositories, reuse reduced total runtime by over 13,700 seconds.
- Scalability: The benefits of reuse grew superlinearly with the size of the repository; as QJoin processes more joins, it becomes increasingly efficient at finding the next one.
Conclusion and Future Work
QJoin demonstrates that reinforcement learning can effectively bridge the gap between raw, messy data and structured join graphs. While highly effective, the system can occasionally be misled by "semantic traps"—columns that look similar and are both unique but represent different entities (e.g., "President" vs. "Vice President"). Future work will focus on expanding the library of transformation operators and incorporating advanced semantic understanding, potentially via specialized small language models, to resolve these ambiguities.
Summary updated