














































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















































10/8/^
Data Streams: Lecture 5
10/8/^
Data Streams: Lecture 5
10/8/^
Data Streams: Lecture 5
Example Query Plan II^ <!--^ Perform
the^ selection
<select^ id="selectop"
input="scan"> <pred^ op="ge">^ <var^ value="$amt"/>^ <number
value="100"/> <!-- Construct the^ result
<construct
id="cons"
**input="selectop">
^ $bidderid^ $amt^
10/8/^
Data Streams: Lecture 5
Input Data Streams Data streams arefaked using files Scan below onthis file wouldproduce twotuples, each withtwo attributes:^ $auctionid,
$bidderid
<niagara:stream xmlns:niagara="http://www.cs.pdx.edu/dot/niagara">
<xmlscan id=“scan”attrs=“auctionid,
bidderid” file^ =^ “…”>
10/8/^
Data Streams: Lecture 5
NiagaraST WID Detailed Example Schema:^ Bids(auctionid,
bidderid,
amt,^ time)
Query:^ Find the maximum bid price for each auctionover the past 3 minutes. Update the result each minute.(Simple window aggregate query.) SELECT^ aid,
MAX(amt) FROM^ Bids
[Range^ 3 Minutes
Slide^1 Minute]
aid
aid=auctionid
10/8/^
Data Streams: Lecture 5
MAX(amt) FROM^ Bids
3 Minutes
Minute]
aid (aid, amt,^ time) t1^ (^ 8,^
t2^ (^ 8,^
t3^ (^ 8,^
t4^ (^ 9,^
t5^ (^ 9,^
t6^ (^ 9,^
t7^ (^ 8,^
t7^ (^ 9,^
t7^ (^ 9,^
t7^ (^ 8,^
10/8/^
Data Streams: Lecture 5
MAX(amt) FROM^ Bids
3 Minutes SLIDE 1 Minute] GROUP^ BY aid
(aid,^ amt,
time) t1^ (^ 8,^
t2^ (^ 8,^
t3^ (^ 8,^
t4^ (^ 9,^
t5^ (^ 9,^
t6^ (^ 9,^
t7^ (^ 8,^
t7^ (^ 9,^
t7^ (^ 9,^
t7^ (^ 8,^
windows: W1:^ 12:00:
10/8/^
Data Streams: Lecture 5
Tuples Belong to Multiple Windows SELECT^ aid,
MAX(amt) FROM^ Bids
3 Minutes
Minute]
aid (aid, amt,^ time) t1^ (^ 8,^
t2^ (^ 8,^
t3^ (^ 8,^
t4^ (^ 9,^
t5^ (^ 9,^
t6^ (^ 9,^
t7^ (^ 8,^
t7^ (^ 9,^
t7^ (^ 9,^
t7^ (^ 8,^
windows: W1:^ 12:00:
10/8/^
Data Streams: Lecture 5 Example^ windowMaxgroups on: aid, wid^ bucket^ xmlscan
(aid,^ amt,
time) (aid,^ amt,
time,^
wid) (^ 8,^ 54.00,
t (^ 8,^ 37.00,
t aid^ wid^
max 8 1
aid^ wid^
max 8 1
1-3)^ t aid^ wid^
max (^ 8,^ 54.00,
1-3)^ t (^ 8,^ 61.00,
windowMax state(hash table)^ t3 windows: W1: 12:00:00 – 12:01:00 W2: 12:00:00 – 12:02:00 W3: 12:00:00 – 12:03:
10/8/^
Data Streams: Lecture 5 Example^ windowMaxgroups on: aid, wid^ bucket^ xmlscan
(aid,^ amt,
time) (aid,^ amt,
time,^
wid)
aid^ wid^
max 8 1
t (^ *,^ *,
1 )^ p (^ 8,^ 61.00,
Output:(aid,^ wid, 2-4)^ t
max) (8,^ 1,^ 54.00)
aid^ wid^
max 8 2
aid^ wid^
max 8 2
t (^ 9,^ 35.00,
2-4)^ t
aid^ wid^
max 8 2
35.00^ windows:^ W1: 12:00:00 – 12:01:00^ W2: 12:00:00 – 12:02:00^ W3: 12:00:00 – 12:03:
10/8/^
Data Streams: Lecture 5
Idea: Explicit Window Ids ^ Append a range of window ids (WIDs) toeach tuple ^ New operator:
Bucket assigns WIDs to
10/8/^
Data Streams: Lecture 5
Idea: Punctuation ^ Bucket will generate a “punctuation” to notifywindowAverage that window 1 is complete ^ Punctuations look like tuples and are intermixedwith tuples in inter-operator queues ^ This punctuation says: all data with wid=1 hasbeen seen.^ (aid,
amt,^ time,
wid) (^ *,^ *,
punctuation
10/8/^
Data Streams: Lecture 5
A.name, B.bidderid,
B.amt
FROM^ Auctions
Bids^ B^ [RANGE
WHERE^ A.id
=^ B.auctionid
AND^ A.sellerid
10/8/^
Data Streams: Lecture 5