- Mar. 18,2003
Query Languages
1
Presented by
Mark Hosang, Wayne Wight, Sedat Behar, Yevgeny Ioffe, Archana Suhas Joshi, Izi Aviyente
Presented by Mark Hosang, Wayne Wight, Sedat Behar, Yevgeny Ioffe, - - PowerPoint PPT Presentation
Presented by Mark Hosang, Wayne Wight, Sedat Behar, Yevgeny Ioffe, Archana Suhas Joshi, Izi Aviyente 1 Mar. 18,2003 Query Languages Timeline ! 1:40 Talk Outline ! 1:45 CQL Primer ! 2:05 SQuAl Primer ! 2:25 ATLaS Primer ! 2:50
Query Languages
1
Mark Hosang, Wayne Wight, Sedat Behar, Yevgeny Ioffe, Archana Suhas Joshi, Izi Aviyente
Query Languages
2
! 1:40 – Talk Outline ! 1:45 – CQL Primer ! 2:05 – SQuAl Primer ! 2:25 – ATLaS Primer ! 2:50 – Break ! 3:00 – Sequence Query Processing ! 3:40 – Similarities and Differences (ATLaS, CQL,
! 3:55 – Class Discussion ! 4:25 – Review Presentation Shortcomings
Query Languages
3
Query Languages
4
! Example Application: Boston Marathon ! STREAM Solution
! Review of STREAM ! CQL ! Example Queries
! AURORA Solution: SQuAl
! Aurora operators ! Example Queries
! Comparisons between Query Languages
Query Languages
5
! Boston Marathon
! Goal: To collect and process data about each runner
continuously
Speed Sensors Distance Sensors Finish Line Alerter Timer
Computer Base Station
Satellite
Query Languages
6
1.
2.
3.
Query Languages
7
! TQL (1992) – SQL based query language of
Set て=-∞ FOREVER DO Set t:= current time Execute Queries QM(t) and QM(て) Return QM(t)-QM(て) to user set て:=t Sleep for some period of time ENDLOOP
Query Languages
8
! NiagraCQ(2000) – XML-QL is used to express
WHERE <athlete> <country>Spain</name> <name> <lastname>$1</lastname> </> </>IN* CONSTRUCT <lastname>$1</lastname>
Query Languages
9
! PSoup(2002) – SQL style queries, windows for Select
Query Languages
10
! Define a concrete query language (CQL) that
! Exploits relational semantics ! Is easy and compact to write ! Uses standard relational transformations for query
Query Languages
11
Tuple belonging to the schema
t∈ て(timestamp)
Query Languages
12
Relation-to-Stream Operators (IStream, DStream, RStream) Window Specification Language Relational Query Language
Query Languages
13
Query Languages
14
Rate ID
S T R E A M
E L A T I O N
Average
Stream Relation
Window Specification Language Relation- Stream Operators
R Q L
R E L A T I O N
E L A T I O N
Average Relation
I S T R E A M s
where s Є R at time T but s Є R at time T-1
where s Є R at time T-1 but s Є R at time T
where s Є R at time T
Query Languages
15
!
!
!
!
!
!
Query Languages
16
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
Query Languages
17
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
Query Languages
18
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
Query Languages
19
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
Query Languages
20
Query Languages
21
Query Languages
22
i1 i2 i0
Filter Rstream Map Map Filter Filter Map Rstream Union
Filter Box Map Box Tumble Box Slide Box Xsection Box Wsort Box Restream Box Merge Box Join Box Resample Box Super Box
Starting an arc at Map Ending an arc at Filter Starting an arc at Filter Ending an arc at Map Box 4 Starting an arc at Map Box 4 Ending an arc at Union
Query Languages
23
! Order-Agnostic Operators
! Filter ! Map ! Union
! Order-Sensitive Operators
! BSort ! Aggregate ! Join ! Resample
Query Languages
24
Query Languages
25
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
Query Languages
26
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
08:20 6.6 9915 08:19 4.9 9909 08:18 5.5 9908 08:17 2.8 9911 08:16 6.2 9915 08:15 4.1 9909 08:14 5 9908 Timestamp Distance Athlete_ID
Query Languages
27
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
08:18 5.5 9908 08:14 5 9908 08:20 6.6 9915 08:16 6.2 9915 08:17 2.8 9911 08:19 4.9 9909 08:15 4.1 9909 Timestamp Distance Athlete_ID
Query Languages
28
Query Languages
29
08:20 6.6 9915 08:19 4.9 9909 08:18 5.5 9908 08:17 2.8 9911 08:16 6.2 9915 08:15 4.1 9909 08:14 5 9908 Timestamp Distance Athlete_ID
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
08:20 10.56 9915 08:19 7.84 9909 08:18 8.8 9908 08:17 4.48 9911 08:16 9.92 9915 08:15 6.56 9909 08:14 8 9908 Timestamp Distance Athlete_ID
Query Languages
30
08:12:17 2.8 9904 08:12:16 6.2 9903 08:12:15 4.7 9902 08:12:14 5 9901 Timestamp Distance Athlete _ID 08:12:20 6.6 9915 08:12:19 4.9 9909 08:12:18 5.3 9908 Timestamp Distance Athlete _ID
08:12:20 6.6 9915 08:12:19 4.9 9909 08:12:18 5.3 9908 08:12:17 2.8 9904 08:12:16 6.2 9903 08:12:15 4.7 9902 08:12:14 5 9901 Timestamp Distance Athlete_ID
Query Languages
31
Query Languages
32
Time Input Stream
Buffer
Query Languages
33
Time
Input Stream
Output Stream
Query Languages
34
Time
Input Stream
Output Stream
Query Languages
35
Example follows
Query Languages
36
205 : 1:00 – 1:59 Tuples : 1, 7 102 : 1:00 – 1:59 Tuples : 2, 6 300 : 1:00 – 1:59 Tuples : 3, 4, 5, 8 205 : 2:00 – 2:59 Tuples : 10, … 102 : 2:00 – 2:59 Tuples : 11, … 300 : 2:00 – 2:59 Tuples : 9, …
1. (300, 1:00, 5.45) 2. (205, 1:00, 5.9) 3. (102, 1:00, 5.5) … 1(205, 1:00, 6.0) 2(102, 1:00, 6.0) 3(300, 1:00, 5.8) 4(300, 1:15, 5.5) 5(300, 1:30, 5.0) 6(102, 1:30, 5.0) 7(205, 1:30, 5.8) 8(300, 1:45, 5.5) 9(300, 2:00, 5.1) 10(205, 2:00, 5.6) 11(102, 2:00, 5.7)
Query Languages
37
205 : 1:00 – 1:59 Tuples : 1, 7 102 : 1:00 – 1:59 Tuples : 2, 6 300 : 1:00 – 1:59 Tuples : 3, 4, 5, 8 205 : 2:00 – 2:59 Tuples : 10, … 102 : 2:00 – 2:59 Tuples : 11, … 300 : 2:00 – 2:59 Tuples : 9, …
1. (300, 1:00, 5.45) 2. (205, 1:00, 5.9) 3. (102, 1:00, 5.5) … 1(205, 1:00, 6.0) 2(102, 1:00, 6.0) 3(300, 1:00, 5.8) 4(300, 1:15, 5.5) 5(300, 1:30, 5.0) 6(102, 1:30, 5.0) 7(205, 1:30, 5.8) 8(300, 2:00, 5.1) 9(205, 2:00, 5.6) 10(102, 2:00, 5.7) 11(300, 1:45, 5.5)
Query Languages
38
1. (Rick, 9:00, V205) 2. (Tim, 9:00, V101) 3. (James, 9:00, V101) 4. (Rick, 9:05, V105) 5. (Tim, 9:05, V106) 6. (James, 9:05, V101) 1. (Sam, 8:55, V205) 2. (John, 8:55, V105) 3. (Adam, 8:55, V104) 4. (Jack, 8:55, V106) 5. (John, 9:05, V205) 6. (Adam, 9:05, V105)
Query Languages
39
Time(S) Distance_covered(D) Resample(F,Size6,OnTime, Assuming O) 12:00 (15,12:03,3) 12:10 (25,12:02,2) (35,12:01,2.5) (15,12:09,3.2) (25,12:07,3.4) (25,12:10,3.5) (15,12:13,3.7)
15,12:00,3 25,12:00,2 35,12:00,2.5 15,12:10,3.45 25,12:10,3.45
Query Languages
40
Speed (Athlete_ID, runRate, timestamp)
SCHEMA: SCHEMA:
Timer (Athlete_ID, time_elapsed, timestamp) Distance_covered (Athlete_ID, distance, timestamp) Finished (Athlete_ID, timestamp) Athlete (Athlete_ID, name, age, country)
Aggregate(Avg(runRate),Assuming O,Size 1 hour,Advance 1 hour)(Speed)
O=Order(On Time,Slack n)
Query Languages
41
! CQL
! Declarative ! No support for time-out
! Supports relations ! No support for out-of-order
streams
! SQuAl
! Procedural ! Support for time-out
! Does not explicitly support
relations
! Tuples need not arrive in
supported