  Complex event processing (CEP) systems continuously evaluate large workloads
of pattern queries under tight time constraints. Event trend aggregation
queries with Kleene patterns are commonly used to retrieve summarized insights
about the recent trends in event streams. State-of-art methods are limited
either due to repetitive computations or unnecessary trend construction.
Existing shared approaches are guided by statically selected and hence rigid
sharing plans that are often sub-optimal under stream fluctuations. In this
work, we propose a novel framework Hamlet that is the first to overcome these
limitations. Hamlet introduces two key innovations. First, Hamlet adaptively
decides whether to share or not to share computations depending on the current
stream properties at run time to harvest the maximum sharing benefit. Second,
Hamlet is equipped with a highly efficient shared trend aggregation strategy
that avoids trend construction. Our experimental study on both real and
synthetic data sets demonstrates that Hamlet consistently reduces query latency
by up to five orders of magnitude compared to the state-of-the-art approaches.
