DB-Inspired Approach to Streams
-
Upload
raphael-bernard -
Category
Documents
-
view
15 -
download
0
description
Transcript of DB-Inspired Approach to Streams
ATLaS:A Complete Database Language for
Streams
Carlo Zaniolo, Haixun WangRichard Luo,Jan-Nei Law
et al.
Documentation and software downloads: http://wis.cs.ucla.edu/
DB-Inspired Approach to DB-Inspired Approach to StreamsStreams
• The Good: – Information-centered, high level Query languages, Data
Independence, Optimization, …– isolate applications from details, amortize investment
• The Bad: SQL lacks expressive power!– New application domain ad-hoc extensions (by
committee)– Designed for secondary store blocking aggregates
assumed
• The Ugly:– The secondary storage mantra is gone– Can SQL designed for secondary store win over languages
such as XQuery, XSLT or Hancock designed for the – web and streams—and also claiming Turing completeness?
A Brave New World
• Just extending SQL for streams will not do, if – SQL remains crippled by its impotency in
expressing applications– and we will lose out against non-DB
approaches since we lost our DB mantra and home field advantage
A Brave New World
• User-Defined Aggregates (UDAs) are a path to salvation because they,– Can be defined in SQL (rather than in a
procedural language)– Turn SQL into a Turing Complete (TC) language– Fit the stream-oriented computation model like
a glove—e.g., non-blocking properties of queries can be characterized syntactically
• ATLaS does all that, and demonstrates the effectiveness of UDAs in expressing data-intensive applications, and delivers good performance.
UDAs: Initialize, Iterate, Terminate
AGGREGATE myavg1(Next Int) :
Real { TABLE state(sm Int, cnt Int);INITIALIZE : {INSERT INTO state
VALUES (Next, 1)}
ITERATE : {UPDATE state SET sm=sm+Next,
cnt=cnt+1;}TERMINATE : {INSERT INTO
RETURN SELECT sm/cnt FROM state;} }
AGGREGATE myavg2(Next Int) : Real
{ TABLE state(sm Int, cnt Int);INITIALIZE : {INSERT INTO state
VALUES (Next, 1)} ITERATE : {UPDATE state SET
sm=sm+Next, cnt=cnt+1;INSERT INTO RETURN
SELECT sm/cnt FROM state WHERE Cnt=100; UPDATE state SET sm=0, cnt=0 WHERE Cnt=100} }
No TERMINATE Non-Blocking
Homework Problems:Solutions in Two Flavors
1. without windows (ATLaS is TC for both blocking and nonblocking functions), and
2. with windows [partition&range construct]• ATLaS provides constructs to simplify the
definition of UDAs on windows,• But ATLaS does not support joins of
windows,since a. Problems when windows are viewed as data sets,b. in SQL:1999 windows are aggregate modifiers (OLAP), c. Simple solutions are already at hand in the TC ATLaS.
• The benefits of TC: we add a new construct only when pros >> cons
Interesting Times Ahead …
Language Design Issues:• Semi-structured information and XML
documents—can they be viewed as streams?• Ditto for references,• Streams of Updates and Events, active
databasesApplications: e.g., micro-climate monitoring,
from UCLA Embedded Networked Sensors Center
. Bridging the gap will not be easy.
References
Stephan Kepser: A Proof of the Turing-completeness of XSLT and Xquery, SFB 441, University of Tubingen Technical Report, SFB 441, May 13, 2002,[email protected]