Docsity

Example Query Plan on Data Stream Model - Paper 10 | CS 410, Papers of Computer Science

Partial preview of the text

Download Example Query Plan on Data Stream Model - Paper 10 | CS 410 and more Papers Computer Science in PDF only on Docsity!

10/8/^

Data Streams: Lecture 5

CS 410/510 Data Streams Lecture 5: Data Stream Models^ Kristin Tufte, David Maier

10/8/^

Data Streams: Lecture 5

Outline „^ NiagaraST Query Plans „^ WindowIDs – Implementation Details^ ‰^ Partial windows at start-up^ ‰^ Calculation of WindowIDs „^ Models & Issues Paper

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">0 T1257.001T21147.00</niagara:stream>

<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]

GROUP^ BY

aid

aid=auctionid

10/8/^

Data Streams: Lecture 5

NiagaraST Example – Data & Windows SELECT^ aid,

MAX(amt) FROM^ Bids

[RANGE^

3 Minutes

SLIDE^1

Minute]

GROUP^ BY

aid (aid, amt,^ time) t1^ (^ 8,^

37.00,^ 12:00:03)

t2^ (^ 8,^

54.00,^ 12:00:34)

t3^ (^ 8,^

61.00,^ 12:01:10)

t4^ (^ 9,^

35.00,^ 12:02:15)

t5^ (^ 9,^

42.00,^ 12:03:51)

t6^ (^ 9,^

45.00,^ 12:04:35)

t7^ (^ 8,^

67.00,^ 12:05:15)

t7^ (^ 9,^

57.00,^ 12:05:20)

t7^ (^ 9,^

65.00,^ 12:06:30)

t7^ (^ 8,^

72.00,^ 12:07:45)

10/8/^

Data Streams: Lecture 5

NiagaraST Example – Data & Windows SELECT^ aid,

MAX(amt) FROM^ Bids

[RANGE^

3 Minutes SLIDE 1 Minute] GROUP^ BY aid

„^ Partial windowsat start-up

(aid,^ amt,

time) t1^ (^ 8,^

37.00,^ 12:00:03)

t2^ (^ 8,^

54.00,^ 12:00:34)

t3^ (^ 8,^

61.00,^ 12:01:10)

t4^ (^ 9,^

35.00,^ 12:02:15)

t5^ (^ 9,^

42.00,^ 12:03:51)

t6^ (^ 9,^

45.00,^ 12:04:35)

t7^ (^ 8,^

67.00,^ 12:05:15)

t7^ (^ 9,^

57.00,^ 12:05:20)

t7^ (^ 9,^

65.00,^ 12:06:30)

t7^ (^ 8,^

72.00,^ 12:07:45)
W1W2W3W4W5 W6 W7 W

windows: W1:^ 12:00:

–^ 12:01:
W2:^ 12:00:
–^ 12:02:
W3:^ 12:00:
–^ 12:03:
W4:^ 12:01:
–^ 12:04:
W5:^ 12:02:
–^ 12:05:
W6:^ 12:03:
–^ 12:06:
W7:^ 12:04:
–^ 12:07:
W8:^ 12:05:
–^ 12:08:

10/8/^

Data Streams: Lecture 5

Tuples Belong to Multiple Windows SELECT^ aid,

MAX(amt) FROM^ Bids

[RANGE^

3 Minutes

SLIDE^1

Minute]

GROUP^ BY

aid (aid, amt,^ time) t1^ (^ 8,^

37.00,^ 12:00:03)

t2^ (^ 8,^

54.00,^ 12:00:34)

t3^ (^ 8,^

61.00,^ 12:01:10)

t4^ (^ 9,^

35.00,^ 12:02:15)

t5^ (^ 9,^

42.00,^ 12:03:51)

t6^ (^ 9,^

45.00,^ 12:04:35)

t7^ (^ 8,^

67.00,^ 12:05:15)

t7^ (^ 9,^

57.00,^ 12:05:20)

t7^ (^ 9,^

65.00,^ 12:06:30)

t7^ (^ 8,^

72.00,^ 12:07:45)

windows: W1:^ 12:00:

–^ 12:01:
W2:^ 12:00:
–^ 12:02:
W3:^ 12:00:
–^ 12:03:
W4:^ 12:01:
–^ 12:04:
W5:^ 12:02:
–^ 12:05:
W6:^ 12:03:
–^ 12:06:
W7:^ 12:04:
–^ 12:07:
W8:^ 12:05:
–^ 12:08:

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

(^ 8,^ 37.00,

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

(^ 8,^ 61.00,

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

(^ 9,^ 35.00,

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

tuples „ Add WID to the list of grouping attributesfor the aggregation operator ‰^ Instead of “group by aid”, “group by aid, wid” ‰^ “Automatically” get a group for each aid, widpair

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) (^ *,^ *,

*,^
1 )^

punctuation

10/8/^

Data Streams: Lecture 5

NiagaraST Window Join Semantics SELECT^ A.id,

A.name, B.bidderid,

B.amt

FROM^ Auctions

A^ [RANGE
10 MINUTES
SLIDE^2
MINUTES],

Bids^ B^ [RANGE

5 MINUTES
SLIDE^2
MINUTES]

WHERE^ A.id

=^ B.auctionid

AND^ A.sellerid

=^0

„^ Map tuples in A and B to window ids usingmethod described in previous slides „^ Add A.wid = B.wid to the join condition:^ ‰^ A.id = B.auctionid AND A.wid = B.wid

10/8/^

Data Streams: Lecture 5

Models and Issues in Data StreamSystems „^ Original DSMS overview paper „^ Data stream model „^ Operators requiring potentially unboundedmemory „^ Blocking/non-blocking operators andimplementations „^ Timestamps and tuple arrival gaps