Abstract
As one of the most useful online processing techniques, the theta-join operation has been utilized by many applications to fully excavate the relationships between data streams in various scenarios. As such, constant research efforts have been put to optimize its performance in the distributed environment, which is typically characterized by reducing the number of Cartesian products as much as possible. In this article, we design and implement a novel fast theta-join algorithm, called Prefap, by developing two distinct techniques—prefiltering and amalgamated partitioning—based on the state-of-the-art FastThetaJoin algorithm to optimize the efficiency of the theta-join operation.
Introduction: The Theta-Join Challenge
In the era of big data, "joining" datasets is a fundamental task. While equi-joins (finding exact matches) are well-optimized, theta-joins are significantly more complex as they handle non-equal relationships, such as finding all instances where a value in Stream A is greater than a value in Stream B ($A.val > B.val$).
The primary challenge of the theta-join is the Cartesian product explosion. In naive distributed setups, systems often compare nearly every element of one stream against every element of another, leading to massive I/O and communication overhead. Existing state-of-the-art algorithms like FastThetaJoin (FTJ) attempt to filter redundant comparisons after partitioning, but they often partition streams in isolation, leaving many redundant calculations on the table.
Methodology: Prefiltering and Amalgamated Partitioning
The Prefap (Pre-filtering and Amalgamated Partitioning) algorithm addresses these inefficiencies through two novel strategies:
- Stream-level Pre-filtering: Unlike previous methods that partition first and filter later, Prefap performs an initial pass to discard data that can never satisfy the join condition. For example, in an $R > S$ join, any value in $R$ that is smaller than the minimum value in $S$ is immediately discarded. This reduces data volume and allows for much tighter partitioning.
- Amalgamated Partitioning: Standard algorithms partition streams independently. Prefap "amalgamates" or fuses the boundaries of both streams. By creating a shared set of partitioning boundaries based on combined data ranges, the algorithm ensures that data buckets align precisely, preventing "dead zones" where partitions overlap without containing joinable results.
- Load Balancing: Prefap retains FTJ’s strengths, such as re-partitioning oversized partitions to ensure work is distributed evenly across worker nodes in a distributed system.
Experimental Evaluation and Results
The researchers evaluated Prefap using synthetic data (Uniform, Normal, and Zipf distributions) and real-world datasets, including wind speed data and historical stock prices.
Prefap demonstrated significant efficiency gains over the previous state-of-the-art (FTJ):
- Computational Efficiency: Prefap reduced the number of Cartesian products by 34.7% for uniform data, 19.4% for skewed Zipf data, and 37.7% for real-world stock data.
- Execution Speed: Prefap consistently showed the shortest elapsed time across all experimental settings, proving that the overhead of pre-filtering and amalgamation is well worth the computational savings.
- Near-Optimal Performance: In multi-way join tests, Prefap performed within 0.026% to 1.7% of the theoretical "optimal" lower bound for Cartesian products.
Conclusion
Prefap significantly accelerates theta-join operations on data streams by slashing the number of redundant Cartesian products. By shifting filtering to the pre-partitioning stage and using collaborative boundary definitions, it achieves near-optimal performance. Future work could explore how Prefap interacts with specific network topologies or cloud-native architectures where data movement costs are non-linear.
Summary updated