CQL - Continuous Query Language

Publié le par Rory

In today’s data driven economy, organizations depend heavily on data analytics to stay competitive. Advances in Big Data related technologies transformed how organizations interact with data and as a result more and more data is generated at ever increasing rates. And most of these data is available as continuous streams and organizations utilizes stream processing technologies to extract insights in real-time (or as data arrives). As a result of this change in how we collect and process data stream processing platforms like Apache Storm, Spark Streaming and Apache Samza were created based on about a decade of experience using Big Data processing technologies such as Hadoop.

But these modern platforms lack support for SQL like declarative query languages and require sound knowledge on imperative style programming and distributed systems to effectively utilize them. But for broader adoption, support for SQL like continuous query languages or SQL with streaming extensions is required. In this post I’m going to discuss one such language known as CQL for querying data streams invented roughly 10 years ago. Theoretical framework and SQL extensions discussed in CQL paper is still important and we are using concepts from CQL as a foundation for Apache Samza’s Streaming SQL implementation.

What is CQL?

CQL is not SQL, but a SQL based declarative language for querying streaming and stored relations (a.k.a. database tables). Abstract semantics of CQL relies on three types of operations – stream-to-relations, relation-to-relation and relation-to-stream – on two types of data – streams and relations.

Streams and relations

Operators

Stream-to-stream operators are absent and they should be constructed by combining three types of operators defined above. Below figure from CQL paper is the best visualization of abstract semantics defined in CQL.

Why CQL is interesting?

Operators like join and some aggregation operators available in SQL are blocking and impossible to evaluate over streams. So, a window operator which divide the stream into possibly overlapping subsets is used after stream scan to reduce the scope of the query to a window extent.

In CQL, the concept of window is embedded into the semantics using the concept instantaneous relation and this allows query execution engines to implement operators such as joins and aggregations as they are operating on general relations. In addition to that, CQL allows integration of stored relations to streaming queries without any magic because once a stream is converted to an instantaneous relation, we are basically working on relations.

In addition to above mentioned semantic features, query execution strategy explained in CQL is also interesting.

CQL Query Execution Streams and Insert/Delete Streams

In CQL runtime stream is represented as a sequence of timestamped insert tuples. And time-varying relation (bag of tuples) is represented as timestamped insert and delete tuples. These insertions and deletions represent the changing state of a relation. This technique makes easy to implement incremental processing of streams.

Synopses are used to maintain the intermediate state such as current contents of a sliding window or current state of a relation for join operation.

More information about CQL query execution can be found in Section 12 of CQL paper.

Limitations

Coming soon.

http://lzw.kimbra.us/M105
http://kso.gerlingcat.com/8He7
http://nwv.gerlingcat.com/phgs
http://spo.gerlingcat.com/8T80
http://opp.kimbra.us/YNyG
http://pvo.karenlindvig.com/P9i3
http://inw.valuesbasedcounseling.com/S53M
http://mxx.karenlindvig.com/c6j6
http://szu.gerlingcat.com/94P9
http://lcx.gerlingcat.com/on2b
http://sqy.valuesbasedcounseling.com/7gE3
http://med.karenlindvig.com/8sOb
http://doj.mediation-seattle.org/YkpQ
http://jiv.mediation-seattle.org/Z5HQ
http://zto.mediation-seattle.org/J8P1
http://ifb.karenlindvig.com/K1c1
http://qfu.mediation-seattle.org/Ck5a
http://oqi.kimbra.us/a1Z5
http://gca.valuesbasedcounseling.com/0qeD
http://pan.kimbra.us/jBTc
http://mdk.kimbra.us/MhOc
http://ruv.kimbra.us/41uD
http://mss.karenlindvig.com/wxww
http://npa.karenlindvig.com/8J1T
http://myc.kimbra.us/uz1K
http://ldo.kimbra.us/9y6E
http://ykw.gerlingcat.com/7V3F
http://kiz.kimbra.us/N3Od
http://dqa.valuesbasedcounseling.com/VFmV
http://scp.valuesbasedcounseling.com/YRJ2
http://yvt.gerlingcat.com/KjWy
http://scf.karenlindvig.com/rULJ
http://duh.valuesbasedcounseling.com/eptN
http://cmj.gerlingcat.com/sJth
http://pfr.mediation-seattle.org/395N
http://lwe.mediation-seattle.org/PRLz
http://esp.valuesbasedcounseling.com/RrPz
http://lpz.karenlindvig.com/lYqG
http://car.gerlingcat.com/dIDe
http://esp.valuesbasedcounseling.com/sr2a

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article