ieee transactions on knowledge and data engineering,...

of 14 /14
Exploiting Punctuation Semantics in Continuous Data Streams Peter A. Tucker, David Maier, Member, IEEE, Tim Sheard, and Leonidas Fegaras, Member, IEEE Abstract—As most current query processing architectures are already pipelined, it seems logical to apply them to data streams. However, two classes of query operators are impractical for processing long or infinite data streams. Unbounded stateful operators maintain state with no upper bound in size and, so, run out of memory. Blocking operators read an entire input before emitting a single output and, so, might never produce a result. We believe that a priori knowledge of a data stream can permit the use of such operators in some cases. We discuss a kind of stream semantics called punctuated streams. Punctuations in a stream mark the end of substreams allowing us to view an infinite stream as a mixture of finite streams. We introduce three kinds of invariants to specify the proper behavior of operators in the presence of punctuation. Pass invariants define when results can be passed on. Keep invariants define what must be kept in local state to continue successful operation. Propagation invariants define when punctuation can be passed on. We report on our initial implementation and show a strategy for proving implementations of these invariants are faithful to their relational counterparts. Index Terms—Continuous queries, stream semantics, continuous data streams, query operators, stream iterators. æ 1 INTRODUCTION T HERE are many examples of stream-processing applica- tions: Financial applications process stock-ticker streams, telephone monitoring applications process call- data streams [7], [10], and traffic monitoring applications process streams from sensors on the highway [16]. These applications can often be viewed as queries over streams. Hence, it may be desirable to use a DBMS to implement all or part of them. However, two properties of streams make them difficult to process: First, data is often generated from a source that can potentially produce an unbounded stream. Second, a stream’s contents can only be accessed sequen- tially. Traditional queries are comprised of relational operators that assume a finite data source that can be accessed randomly. We need operators designed for stream inputs. 1.1 Streaming Data Examples Example 1 Tracking Temperature in a Warehouse. A warehouse containing temperature-sensitive merchan- dise may deploy temperature sensors to regularly report the current temperature to a monitoring system, as shown in Fig. 1a. The monitoring system is implemented as a query that unions all temperature reports (removing duplicates), groups all reports for each hour, and outputs the maximum temperature reported for each group. Unfortunately, the approach above will fail for two reasons: First, duplicate elimination requires an un- bounded amount of state. Thus, the system will ultimately run out of memory. Second, group-by must wait until all data from its input has been read before it can output results. Since the input is a continuous stream, it will never emit a result. Example 2 Tracking Bids at an Online Auction. The XMark benchmark [21] tests queries over stored auction data. We extend this to an online auction, shown in Fig. 1b. Sellers post items for sale to the Sellers portal, which merges submissions into a single output stream. Bidders post increase bids to the Buyers portal, which merges bids into a single output stream. A useful query tracks final prices for items, joining items for sale with item bids, and then summing up bid-increase values for each item. We use the symmetric hash join [27] to join the two inputs. This implementation does not block on its inputs, but maintains an unbounded amount of state. Through- out the auction, hash tables used for the join grow without bound, so the system eventually runs out of memory. Further, the group-by operator that calculates the sum does not output any results until all items have arrived. 1.2 Motivation for Punctuated Streams The examples illustrate two kinds of operators that are impractical for continuous data streams. Blocking operators, such as group-by, wait until all data from at least one input has been read before producing a result. Unbounded stateful operators, such as join, maintain state that grows with no upper bound. Our goal is to find stream-based analogues for table-based (finite) operators, exploiting stream seman- tics to overcome these problems. Our work builds on a simple observation: When an input has been read entirely, blocking operators emit results and unbounded stateful operators discard state. Could query operators do similar work if the end of a specific subset of data had been read entirely? A blocking operator might be able to emit a subset of its result early. An unbounded stateful operator might reduce state. We use special annotations embedded in data streams, called punctuations, IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003 1 . P.A. Tucker, D. Maier, and T. Sheard are with the OGI School of Science and Engineering at OHSU, 20000 NW Walker Road, Beaverton, OR 97006. E-mail: {ptucker, maier, sheard}@cse.ogi.edu. . L. Fegaras is with the Department of Computer Science and Engineering, The University of Texas at Arlington, 416 Yates Street, 301 Nedderman Hall, PO Box 19015, Arlington, TX 76019. E-mail: [email protected] Manuscript received 15 May 2002; revised 15 Nov. 2002; accepted 4 Dec. 2002. For information on obtaining reprints of this article, please send e-mail to: [email protected], and reference IEEECS Log Number 117896. 1041-4347/03/$17.00 ß 2003 IEEE Published by the IEEE Computer Society

Author: others

Post on 22-Aug-2020

0 views

Category:

Documents


0 download

Embed Size (px)

TRANSCRIPT

  • Exploiting Punctuation Semantics inContinuous Data Streams

    Peter A. Tucker, David Maier, Member, IEEE, Tim Sheard, and Leonidas Fegaras, Member, IEEE

    Abstract—As most current query processing architectures are already pipelined, it seems logical to apply them to data streams.

    However, two classes of query operators are impractical for processing long or infinite data streams. Unbounded stateful operators

    maintain state with no upper bound in size and, so, run out of memory. Blocking operators read an entire input before emitting a single

    output and, so, might never produce a result. We believe that a priori knowledge of a data stream can permit the use of such operators

    in some cases. We discuss a kind of stream semantics called punctuated streams. Punctuations in a stream mark the end of

    substreams allowing us to view an infinite stream as a mixture of finite streams. We introduce three kinds of invariants to specify the

    proper behavior of operators in the presence of punctuation. Pass invariants define when results can be passed on. Keep invariants

    define what must be kept in local state to continue successful operation. Propagation invariants define when punctuation can be

    passed on. We report on our initial implementation and show a strategy for proving implementations of these invariants are faithful to

    their relational counterparts.

    Index Terms—Continuous queries, stream semantics, continuous data streams, query operators, stream iterators.

    1 INTRODUCTION

    THERE are many examples of stream-processing applica-tions: Financial applications process stock-tickerstreams, telephone monitoring applications process call-data streams [7], [10], and traffic monitoring applicationsprocess streams from sensors on the highway [16]. Theseapplications can often be viewed as queries over streams.Hence, it may be desirable to use a DBMS to implement allor part of them. However, two properties of streams makethem difficult to process: First, data is often generated froma source that can potentially produce an unbounded stream.Second, a stream’s contents can only be accessed sequen-tially. Traditional queries are comprised of relationaloperators that assume a finite data source that can beaccessed randomly. We need operators designed for streaminputs.

    1.1 Streaming Data Examples

    Example 1 Tracking Temperature in a Warehouse. Awarehouse containing temperature-sensitive merchan-dise may deploy temperature sensors to regularly reportthe current temperature to a monitoring system, asshown in Fig. 1a. The monitoring system is implementedas a query that unions all temperature reports (removingduplicates), groups all reports for each hour, and outputsthe maximum temperature reported for each group.

    Unfortunately, the approach above will fail for tworeasons: First, duplicate elimination requires an un-bounded amount of state. Thus, the system willultimately run out of memory. Second, group-by must

    wait until all data from its input has been read before itcan output results. Since the input is a continuousstream, it will never emit a result.

    Example 2 Tracking Bids at an Online Auction. The XMarkbenchmark [21] tests queries over stored auction data.We extend this to an online auction, shown in Fig. 1b.Sellers post items for sale to the Sellers portal, whichmerges submissions into a single output stream. Bidderspost increase bids to the Buyers portal, which mergesbids into a single output stream. A useful query tracksfinal prices for items, joining items for sale with itembids, and then summing up bid-increase values for eachitem.

    We use the symmetric hash join [27] to join the twoinputs. This implementation does not block on its inputs,but maintains an unbounded amount of state. Through-out the auction, hash tables used for the join growwithout bound, so the system eventually runs out ofmemory. Further, the group-by operator that calculatesthe sum does not output any results until all items havearrived.

    1.2 Motivation for Punctuated Streams

    The examples illustrate two kinds of operators that areimpractical for continuous data streams. Blocking operators,such as group-by, wait until all data from at least one inputhas been read before producing a result. Unbounded statefuloperators, such as join, maintain state that grows with noupper bound. Our goal is to find stream-based analoguesfor table-based (finite) operators, exploiting stream seman-tics to overcome these problems.

    Our work builds on a simple observation: When an inputhas been read entirely, blocking operators emit results andunbounded stateful operators discard state. Could queryoperators do similar work if the end of a specific subset ofdata had been read entirely? A blocking operator might beable to emit a subset of its result early. An unboundedstateful operator might reduce state. We use specialannotations embedded in data streams, called punctuations,

    IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003 1

    . P.A. Tucker, D. Maier, and T. Sheard are with the OGI School of Scienceand Engineering at OHSU, 20000 NW Walker Road, Beaverton, OR97006. E-mail: {ptucker, maier, sheard}@cse.ogi.edu.

    . L. Fegaras is with the Department of Computer Science and Engineering,The University of Texas at Arlington, 416 Yates Street, 301 NeddermanHall, PO Box 19015, Arlington, TX 76019. E-mail: [email protected]

    Manuscript received 15 May 2002; revised 15 Nov. 2002; accepted 4 Dec.2002.For information on obtaining reprints of this article, please send e-mail to:[email protected], and reference IEEECS Log Number 117896.

    1041-4347/03/$17.00 � 2003 IEEE Published by the IEEE Computer Society

  • to specify the end of a subset of data. Informally, apunctuation indicates no more tuples will follow thatmatch the punctuation. We show that punctuations allowblocking and unbounded stateful operators to be used overcontinuous data streams for a larger range of queries.

    1.3 Enhancing the Examples with Punctuations

    We can fix the temperature monitoring system (Example 1)by embedding punctuations in sensor reports. Supposereports are of the form < sid; hour; minute; currtmp >. Weenhance the temperature sensors to embed punctuations atthe end of each hour, stating that all reports have beenemitted for that hour. When punctuations from all sensorsfor a particular hour have been received by union, we knowthat there will be no reports from any sensor for that hour.Tuples that match those punctuations no longer need beretained in operator state. Likewise, when group-byreceives punctuation for a particular hour, results can beemitted for that hour, and state relating to those groups isno longer needed.

    Punctuations also fix the online auction (Example 2).Items submitted to the Sellers portal are assigned aunique itemid. Once emitted, a punctuation followsstating no more items with that itemid will appear. Asmentioned earlier, join maintains two hash tables: one foritems for sale and the other for bids. Punctuation from theSellers portal tells the join that items in its bid hash tablewith that itemid can be removed since all items with thatitemid have arrived from the Sellers input. Further,when the auction for an item has closed, a punctuation canbe embedded into the bid stream stating no more bids forthat item will arrive. We can use this information to discardstate in the items-for-sale hash table related to that item.Finally, once punctuations for a particular item are presentfor both inputs, join can emit its own punctuation, statingthat it will not emit any more tuples with that itemid. Thegroup-by operator can use that punctuation to determinethat no more bid increases will arrive for that item and canemit its result for that item.

    1.4 Organization

    The rest of this paper is organized as follows: We formalizethe notion of stream iterators in Section 2. Section 3introduces punctuation semantics and Section 4 discussesour stream iterators model. Section 5 presents the theorybehind punctuated data streams. Section 6 discussesconcerns regarding punctuated streams. Section 7 givesour experiences and results of modifying relational opera-tors in a query engine to use punctuated streams. Wediscuss related work in Section 8 and conclude in Section 9.

    2 STREAMS AND STREAM ITERATORS

    We first deal with streams and stream iterators withoutpunctuations. For the moment, we will represent streams asinfinite sequences, like the usual cons-based formulation oflists, but with no nil list. Thus, a stream over elements oftype T can be defined as Stream(T) = T � Stream(T),where � is an infix constructor.

    We use fj . . . jg to denote stream values, to distinguishthem from finite lists. Thus, for Stream(Int), we write1� 3� 5� 7� . . . as fj1; 3; 5; 7; . . . jg. We write S[i] for thefunction that extracts the first i elements from a stream S,with type Stream(T) � Int ! List(T). Thus, S[3] is[1, 3, 5]. Further, for n > i, we use S½i ! n� for the list ofelements from iþ 1 to n. Note that S½i� ¼ S½0 ! i�. We [email protected] to mean the ith element of the stream. We use � toconstruct streams from a finite list and another stream. Thus,[2, 4, 6] � Smeans 2� 4� 6� S.

    2.1 Stream Iterators

    We do not want to use arbitrary stream-to-stream functionsfor operating on data streams. In particular, we want toavoid formulations that must access the entire stream atonce. Thus, we introduce stream iterators that access theinput incrementally. Function f : StreamðTÞ ! StreamðUÞis a stream iterator if there exists q : ListðTÞ ! ListðUÞ suchthat for any S 2 StreamðTÞ,

    fðSÞ ¼ ðqðS½1�Þ � qðS½2�Þ � . . .� qðS½i�Þ � . . .Þ:That is, f is a stream iterator if it can be defined as repeatedapplication of q over all finite prefixes of the input stream.For example, select can be expressed as a stream iterator.Given predicate p, we define q by:

    qðLþþ½a�Þ ¼ ½a� if pðaÞ; ½ � otherwise:That is, q just looks at the last element of each prefix and

    emits it if it satisfies the predicate (“++” is list concatenation).There is also a stream iterator for duplicate elimination(which we will henceforth refer to as dupelim), where q is:

    qðLþþ½a�Þ ¼ ½a� if :elemða; LÞ; ½ � otherwise:That is, q checks that the final element in the prefix does

    not appear earlier in the prefix. However, sort and group-bycannot be expressed as stream iterators in our formulation,as their results cannot be determined with only a prefix ofthe input.

    2.2 Representation IssuesThe model of a stream as an infinite sequence has anattractive simplicity to it and is directly supported inlanguages with lazy evaluation, such as Haskell. However,we found it had certain limitations for stream iterators.Those limitations concerned both modeling capabilities andpragmatic programming issues.

    Representation of finite streams: A stream that actuallyhas only a finite number of elements in it is not directlyrepresentable as an infinite sequence. We consideredvarious alternatives, such as “stalling” after the last inputelement, padding the sequence with an infinite numberof null values, or using both finite and infinite sequences.All of these options tended to complicate the program-ming model for streams.

    Independence of iterator and stream rates: We do not wantto build any assumption into our model that operatoriterators are synchronized with stream arrival. There

    2 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003

    Fig. 1. (a) System to monitor temperature reports within a warehouse.

    (b) System to track bids for an auction. Diamond outlines represent

    Buyers and Sellers portals.

  • may be multiple arrivals between iterator steps. Moreproblematically, there may be no stream elementsarriving at a given step. With an infinite sequencerepresentation, no available input means blocking on itsarrival (creating problems for operators with multipleinputs) or requiring a change in the sequence interface.

    Interleaving of multiple units: Just as we do not want toassume an input stream is synchronized with operatoriterations, different inputs need not necessarily proceed“in step.” “Desynchronizing” multiple inputs requiressome kind of extension to infinite sequences as input toensure fairness and avoid blocking on one stream wheninput is available on the other.

    To deal with these difficulties, we model a data stream asan infinite sequence of finite lists of elements—sort of a“sliced list.” For example, the sequence fj1; 2; 3; 4; 5; . . . jgmight appear in sliced form as fj½1; 2�; ½3�; ½ �; ½4; 5�; . . . jg or asfj½1; 2; 3�; ½4; 5�; . . . jg or in many other forms.

    We still use S[i] to represent a finite prefix of a stream,but now it refers to the first i slices. So, if

    S ¼ fj½1; 2�; ½3�; ½�; ½4; 5�; ½6�; . . . jg;then S½4� ¼ ½1; 2; 3; 4; 5�. Stream iterators with multipleinputs take slices from each input in turn. Thus, an iteratorwith n inputs will consume n � i slices after completingstage i.

    This sliced representation overcomes the problemsmentioned above. It can model a finite stream using atrailing sequence of empty slices: fj½1; 2�; ½3�; ½ �; ½ �; ½ �; . . . jg.The slices model the variability in stream arrivals relative toiterator steps. Finally, it can capture different interleavingsof multiple inputs with alternative slicings of the streams.We use this representation mainly for modeling streamiterators and reasoning about them. In our prototype (seeSection 7), operators use nonblocking reads from buffers toretrieve data.

    We did consider a variety of other representations, butthey all seemed to add complexity without discernableimprovement in modeling stream behavior or iteratorimplementation. Interleaving inputs into a single sequencerequires tagging elements for which input they belong to,and development of a notion of “fair merge” of streams. Weconsidered adding an extra input sequence to each iteratorthat could indicate which stream sequence to access next orwhere input was available, but that approach led toconsiderable complication in iterator implementation. La-beling stream elements with an arrival time proved to beessentially equivalent to sliced streams. We also consideredcapturing input interleaving inside iterators rather than inthe data stream representation. Strict element-at-a-timealternation was unrealistic. Deciding which input to readfrom next by a random choose function leads to problems inrepeatability.

    The change to stream iterators is to not provide the entirestream prefix at each iteration. Some iterators, such asselect, only require the most recent input element todetermine the next output. Other iterators only need asummary of the prefix. For example, dupelim only needsthe distinct values in the prefix. Thus, we let iterators keepstate from iteration to iteration. That state might be empty,or all input seen to that point, or some summary. Theexplicit representation of state also points up that there existtable operators with stream analogues, but where thestream iterator must keep track of arbitrary amounts ofthe prefix, such as dupelim. Keeping state does not change

    the set of expressible stream functions. Any function in theprefix version can be converted to the stateful version andvice versa.

    3 PUNCTUATION SEMANTICS

    A punctuation can be seen as a predicate on streamelements that must evaluate to false for every elementfollowing the punctuation. Thus, we might representpunctuations as “black box” Boolean functions. We insteadrepresent punctuations as data to allow their easy storage,searching, and manipulation. There are many choices forwhat punctuation to represent. The scheme in our currentimplementation is fairly simple, but has the importantproperty that the “and” of any two punctuations is also apunctuation.

    Our stream elements are tuples of scalars and punctua-tions for such tuples. A punctuation is an ordered set ofpatterns, each pattern corresponding to an attribute of atuple. We define five kinds of patterns and the values theymatch as:

    . A wildcard, denoted as �, matches all values.

    . A constant is a single value and matches only thatvalue.

    . A range is denoted with ½a; b� for inclusive ranges orða; bÞ for exclusive ranges and matches values thatfall in the range.

    . A list is denoted as fa; b; cg and matches values inthe list.

    . The empty pattern, denoted as ;, does not match anyvalues.

    A punctuation p thus describes a set of tuples where, foreach tuple t, value t.A matches pattern p.A for everyattribute A. In Example 2, if the bid structure is:

    < itemid; increase; buyerid >;

    the punctuation < f1001; 2004g; �; � > describes all bids onitems 1001 and 2004.

    3.1 Manipulating Punctuations

    We define two basic functions for manipulating punctua-tions in streams. The match function takes a tuple t and apunctuation p, and returns True if t belongs to the subsetdescribed by p. The combine function takes two punctua-tions and returns a new punctuation that is either theintersection of the two inputs (if the sets they describeintersect) or the special punctuation �, indicating that nononempty combination exists. Thus,

    matchðt; ðcombineðp1; p2ÞÞÞ , matchðt; p1Þ ^ matchðt; p2Þ:

    We define auxiliary functions for single and lists of inputsbased on match and combine, as defined in Table 1.Additionally, since our input is now a mixture of tuples andpunctuations, we need two functions to split them out. Thefunction tups takes a list of stream elements and returnsonly the tuples, and puncts takes a list of stream elementsand returns only the punctuations in its input.

    A punctuated stream is a data stream that containsadditional information describing a (possibly empty) subsetof data over the domain of the stream. A punctuated streamS is grammatical if for all i, for all j > i, if p 2 S½i� and t 2S½i ! j�, then nomatchðt; pÞ. Stream sources and streamiterators must output grammatical streams.

    TUCKER ET AL.: EXPLOITING PUNCTUATION SEMANTICS IN CONTINUOUS DATA STREAMS 3

  • 3.2 Puncutation Behaviors: Pass, Propagate,and Keep

    We have found it helpful to separate three aspects of streamiterator behavior, in the presence of punctuated streams:

    Pass behavior. Tuples that can be output based onpunctuation received.

    Propagate behavior. Punctuations that can be properlyoutput based on punctuation (and possibly tuples)received.

    Keep behavior. The portion of state that must be retainedbased on punctuation.

    These three behaviors manifest themselves in our workin two ways. First, in Section 4, we present a genericframework for punctuated-stream iterators. In this frame-work, we show that the specific behavior of each iteratorcan be defined using behavior functions, called pass, prop,and keep. Behavior functions are called repeatedly as theiterator works through its input(s). Second, in Section 5, wedefine invariants that specify the cumulative behavior of aniterator enhanced for punctuated streams. We call theseformal invariants cpass, cprop, and ckeep. We use theseinvariants to prove that our implementations of streamiterators are reasonable counterparts to relational operators.

    4 OUR STREAM PROCESSING FRAMEWORK

    We initially made ad hoc extensions to the Niagara queryengine [18] to test the feasibility of our approach (seeSection 7). After encouraging results, we abstracted thebehavior of stream iterators into a high-level model. Theresult is a common control structure for stream iterators,customized by plugging in functions specific to eachiterator. We chose the Haskell programming language[14], a lazy evaluation functional language, to express oursemantics, though any other languages or formalisms couldhave been used. We chose Haskell for three reasons: First,lazy evaluation languages do not evaluate expressions untilrequired. Functions that take streams as arguments evaluateitems from the stream only as needed. Thus, they are verysuitable for modeling stream processing systems and havebeen used to model streams elsewhere [12], [15], [20]. Thisbehavior is similar to Graefe’s iterator function next [11],which retrieves only the next item from its input. Second,since functions are first-class objects, they can be argumentsto other functions. We can formulate the general behavior ofall stream iterators in a single function and pass iteratorspecifics as function arguments to the general function.Finally, since it is a language with formal semantics (at least

    the part we use), it helps us prove our implementationsconform to the appropriate punctuation behaviors.

    It is appropriate to give a very brief explanation of theHaskell features used in our framework, defined in thestandard Haskell library (prelude.hs). The fst functiontakes a tuple and returns the first value from the tuple. Forexample, fstðð1; 2ÞÞ returns the value 1. The infix function“þþ” concatenates two lists. The infix function “\\”removes items from its first argument that exist in itssecond argument. We also use the infix “:” operator, whichtakes an item and a list and adds the item to the head of thelist. In this discussion, we modified the Haskell syntaxslightly to better match the logic notation often used indatabase semantics. We explain other Haskell features asthey are encountered.

    4.1 A Formulation for Stream Iterators

    Without punctuations, stream iterators closely resembleParker’s stream transducers [19]. A unary stream iterator is atriple ðinitial state; step; finalÞ, where:

    . initial state is the iterator state before tuplesarrive from the input.

    . step is called when new data arrives. It takes thenew tuples and the current state, and returns anynew output tuples and a modified state.

    . final is called when the stream ends. It takes thecurrent state and returns any new tuples and amodified state.

    The general behavior of unary stream iterators ismodeled by the unary function, which takes a statevariable (st), the step and final functions, and theinput stream:

    unary(st, step, final, []) = fst(final(st))

    unary(st, step, final, (xs:rest)) =

    out ++ unary(new_st, step, final, rest)

    where (out,new_st) = step(xs, st)

    Note there are two equations that define unary. Haskell usespattern-matching to determine which of the equations toevaluate. If the fourth parameter to unary matches thepattern[], then the first equation is evaluated. In this case,wehave reached the end of the input and output the tuplesreturned from final. If the fourth parameter is a nonemptylist, then the secondequation is evaluated.The first item in thelist is matched to the variable xs and the rest of the list ismatched to the variable rest. In this case, we call the stepfunctionwithxsand the state.Weoutput any results fromthestep function, then recursively callunarywith thenewstateand the rest of the input. Note, we also take advantage of

    4 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003

    TABLE 1Functions Built from the Basic Functions, where t is a Tuple, ts is a Finite List of Tuples,

    p is a Punctuation, and ps is a Finite List of Punctuations

  • Haskell’s where syntax, which allows us to assign values tovariables.

    We can define dupelim in terms of unary as follows:

    sdupelim(xs) =unary([], step, final, xs)

    where step(ts, st) =

    ((� (ts - st)), st [ ts)final (tsSeen) = ([], [])

    We maintain a list of all unique values that have arrivedfrom the input so far in state (st), with the empty list as theinitial state. The step function returns any tuples notcurrently in the state and a new state containing the unionof new tuples and tuples in the original state. The finalfunction clears the state. We use � to mean duplicateelimination over a finite list, as per Albert [1]. That is, givensome finite list A, �ðAÞ ¼ ftjt 2 Ag.

    Let us see how sdupelim works with an example.Suppose we have the input stream

    S ¼ fj½1; 5�; ½3�; ½�; ½5; 6; 7�; . . . jg:To evaluate sdupelim(S), each slice of the stream and thecurrent state will be passed to the step function as follows:

    function input state output newstatestep ½1; 5� ½ � ½1; 5� ½1; 5�step ½3� ½1; 5� ½3� ½1; 5; 3�step ½ � ½1; 5; 3� ½ � ½1; 5; 3�step ½5; 6; 7� ½1; 5; 3� ½6; 7� ½1; 5; 3; 6; 7�. . .

    A binary stream iterator is defined as a five-tuple:(initial_state, stepL, stepR, finalL, finalR). Themeanings of stepL and stepR are the same as step for aunary operator, defined for each input. Likewise, finalLand finalR are the same as final, defined for each input.The formal definition of binary is similar to unary and isomitted. We can implement stream difference (sdiff)using binary:

    sdiff(lxs,rxs) =

    sdupelim(binary((False,[],[]), stepL,

    finalL, stepR, finalR))

    where stepL(ts,(False, xs, ys)) =

    ([], (False, ts [ xs, ys))stepL(ts,(True, xs, ys)) = ((ts - ys),

    (True, [], ys))

    stepR(ts,(fYs, xs, ys)) = ([], (fYs, xs,

    ts [ ys))finalL(f, xs, ys) = ([], (f, xs, ys))

    finalR(f, xs, ys) =(xs - ys, (True, [],

    ys))

    We maintain a structure with a Boolean and two lists oftuple in state. The Boolean is set to True when the negativeinput reaches its end. The two lists store tuples from eachinput. We see from stepL and stepR that sdiff blocks onits negative input—results are emitted only after thenegative input has been read completely. Additionally,sdiff maintains an unbounded amount of state. The twolists grow as more input arrives.

    4.2 Extension to Punctuated StreamsTo enhance stream iterators for punctuated streams, wedefine three new behavior functions: pass, prop, and

    keep, and we redefine unary stream iterators to

    ðinitial state; step; pass; prop; keepÞ, where:

    . initial state and step have the same meaning asbefore.

    . pass takes new punctuations and state, and returnsany additional tuples that can be output based onthe punctuations.

    . prop takes new punctuations and state, and returnspunctuations to be output.

    . keep takes new punctuations and state, and returnsa modified state.

    Changes to unary and binary for punctuated streams

    are similar, so we focus on unary. Input slices may now

    contain both tuples and punctuation, so they are first

    separated. Then, step is called with new tuples and the

    state, followed by calls to pass, prop, and keep with new

    punctuations and the state. The execution order of the

    punctuation functions is important: The prop function

    could output punctuation that matches tuples output by

    pass, so pass must be executed before prop. Further,

    keep must follow pass and prop since both depend on

    state that keep might modify. Note final, called when the

    input stream ended, was removed. Clearly final performs

    the equivalent tasks to pass, prop, and keep combined at

    the end of stream.Some stream iterators do not need to implement

    particular behavior functions. For example, dupelim is not

    a blocking operator. It does not need to implement a special

    pass function. We define trivial behavior functions for

    cases such as this:

    passTðps; stÞ ¼ ½ �; propTðps; stÞ ¼ ½ �; keepTðps; stÞ ¼ st

    We redefine sdupelim to exploit punctuations as

    follows:

    sdupelim(xs) = unary([],step,passT,

    prop,keep,xs)

    where step(ts,st) = ((�

    (ts - st)), st [ ts)prop(ps,st) = ps

    keep(ps,st) = st -

    setMatchTs(st,ps)

    In the original version, we kept all unique tuples that had

    arrived. However, punctuations tell us what tuples will

    never again appear in the stream. Any tuples in state that

    we know can have no more duplicate values in the stream

    can be removed, and that is what the keep function does.

    The prop function propagates all punctuation as it arrives.Let us revisit sdupelim with the same example

    enhanced with punctuations. We add a punctuation that

    no elements follow between 0 and 4, so

    S ¼ fj½1; 5�; ½3�; ½Pð0; 4Þ�; ½5; 6; 7�; . . . jg:

    In this illustration, we omit calls to passT.

    TUCKER ET AL.: EXPLOITING PUNCTUATION SEMANTICS IN CONTINUOUS DATA STREAMS 5

  • function input state output newstatestep ½1; 5� ½ � ½1; 5� ½1; 5�prop ½ � ½1; 5� ½ �keep ½ � ½1; 5� ½1; 5�

    step ½3� ½1; 5� ½3� ½1; 5; 3�prop ½ � ½1; 5; 3� ½ �keep ½ � ½1; 5; 3� ½1; 5; 3�

    step ½ � ½1; 5; 3� ½ � ½1; 5; 3�prop ½Pð0; 4Þ� ½1; 5; 3� ½Pð0; 4Þ�keep ½Pð0; 4Þ� ½1; 5; 3� ½5�

    step ½5; 6; 7� ½5� ½6; 7� ½5; 6; 7�prop ½ � ½5; 6; 7� ½ �keep ½ � ½5; 6; 7� ½5; 6; 7�

    . . .

    For the first two slices of input, execution follows thenonpunctuated case. Since no punctuations arrive duringthe first two slices, the prop and keep functions have noeffect. When a punctuation arrives, however, we see newbehavior. The prop function receives the new punctuationand returns it. The keep function receives the punctuationand keeps only tuples that do not match the punctuation inthe new state.

    Now, consider the enhanced version of sdiff with newbehavior functions:

    sdiffðlxs; rxsÞ ¼ sdupelimðbinaryðð½ �; ½ �; ½ �; ½ �Þ;stepL; passT; propT; keepL;

    stepR; passR; propR; keepR; lxs; rxsÞÞwhere stepLðts; ðlts; rts; lps; rpsÞÞ ¼

    ð½ �; ðtsþþ lts; rts; lps; rpsÞÞstepRðts; ðlts; rts; lps; rpsÞÞ ¼

    ð½ �; ðlts; tsþþ rts; lps; rpsÞÞpassRðps; ðlts; rts; lps; rpsÞÞ ¼

    setMatchTsððlts nnrtsÞ; ðpsþþ rpsÞÞpropRðps; ðlts; rts; lps; rpsÞÞ ¼

    setCombineðlps; ðpsþþ rpsÞÞkeepLðps; ðlts; rts; lps; rpsÞÞ ¼

    ðlts; rts; psþþ lps; rpsÞkeepRðps; ðlts; rts; lps; rpsÞÞ ¼

    ðltsNew; rtsNew; lps; psþþ rpsÞwhere ltsNew ¼ setNomatchTsððlts nnrtsÞ;

    ðpsþþ rpsÞÞrtsNew ¼ setNomatchTsðrts; lpsÞ

    The data structure for state has changed. We no longer needa Boolean value to tell us when we have reached the end ofthe negative input. Punctuations tell us this. However, wedo need to maintain two additional lists for punctuationsfrom each input. We can see that the stepL and stepRfunctions still do not produce output. However, passRoutputs tuples before the end of the stream. Tuples can beemitted from the positive input that match punctuationfrom the negative input and have not appeared so far fromthe negative input. Thus, sdiff is no longer blocking. ThepropR function only outputs certain punctuations. Wecannot simply output punctuations as they arrive, as we didfor sdupelim. Instead, we output punctuations that are

    nonempty combinations of punctuations received fromeach input. Finally, keepR decreases the amount of staterequired when punctuations arrive. We only keep tuplesthat do not match punctuations from the opposite input.

    5 CORRECTNESS OF PUNCTUATED ITERATORS

    There is a significant issue we have not yet addressed,namely: When is a stream iterator a “reasonable” counter-part of the corresponding relational operator? We hope theexamples presented thus far seem sensible, but clearly, onecan define stream versions of operators with obviouslyinappropriate behavior. We use three kinds of invariants tospecify how a stream iterator should process punctuation:pass invariants, propagation invariants, and keep invariants.These invariants are defined below in terms of the allowableaction on any given prefix of the input stream(s). We use theinvariants in our proofs that specific stream iterators satisfycorrectness conditions.

    The correspondence between cpass and ckeep invar-iants and pass and keep functions is not quite direct. Ourframework is based upon the definitions for the nonpunc-tuated case, captured in the step function. Thus, the cpassand ckeep invariants actually specify the desired behaviorof the pass and keep functions in combination with step.

    5.1 Faithfulness and ProprietyWe base our notions of correctness of a stream iterator(termed “faithfulness” and “propriety”) upon its series ofpartial outputs after processing each slice of its input(s). Theoutput of iterators at any point in the input should beconsistent with any possible further input.

    We first define faithfulness for streams without punctua-tion. Let f be a unary stream iterator from Stream(T) toStream(U), and let g be a relational operator fromList(T) to List(U). We say f is faithful to g if thefollowing two conditions are met (note, we interpret � asprefix or subset depending on whether order is significantfor g or not):

    Safety. For all streams S in Stream(T), for all subsets(prefixes) of S of size (length) i, and for every finiteaddition A in List(T), fðSÞ½i� � gðS½i� þ þ AÞ. That is,we never emit output unless we can be sure it will notconflict with any later input.

    Completeness. For all streams S in Stream(T), for allsubsets (prefixes) of S of size (length) i, and for all M, if M� gðS½i� þ þ AÞ for all finite additions A in List(T),then M � fðSÞ½i�. That is, we always emit an output if itwill necessarily be generated by the relational operatorunder any additional input, including no input.The corresponding conditions for binary operators are

    similar:

    fðS1; S2Þ½2i� � gðS1½i� þ þ A1; S2½i� þ þ A2Þ

    for all A1 and A2, and M � fðS1; S2Þ½2i� if M �gðS1½i� þ þ A1; S2½i� þ þ A2Þ. (Note the 2i index is becausef will emit a slice of output for both the ith slices of S1 andS2.)

    Every monotone relational operator g has a faithfulstream counterpart. For unary operators, it is the iterator fwhere fðSÞ@i ¼ gðS½i�Þ � gðS½i� 1�Þ. Thus, fðSÞ½i� ¼ gðS½i�Þ,satisfying the two conditions.

    With punctuation, we modify the conditions of faithful-ness such that any possible additional input is constrainedto obey any punctuation already seen.

    6 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003

  • Safety. For all S in Stream(T), for all subsets (prefixes) ofS of size (length) i, and for every possible finite additionA in List(T) such that setMatchTsðA; punctsðS½i�ÞÞ = ;,tupsðfðSÞ½i�Þ � gðtupsðS½i�Þ þ þ AÞ.

    Completeness. For all S in Stream(T), for all subsets(prefixes) of S of size (length) i, and for all M, if for allpossible finite additions A in List(T) such thatsetMatchTsðA; punctsðS½i�ÞÞ = ; and M � gðtupsðS½i�Þþ þ AÞ, then M � tupsðfðSÞ½i�Þ.

    The definition for binary operators is extended in a similarway. We will provide correctness proofs for some streamiterators later in this section.

    The other condition we want to enforce on our streamoperators is that they are well-behaved with respect topunctuation. We say that a stream iterator f is proper iff(S) is guaranteed to be grammatical whenever S isgrammatical. Note that propriety is not a very strongcondition. An iterator that emits no punctuation will alwaysbe proper. We are currently investigating stronger notionsregarding punctuation, such as requiring an iterator to emitthe maximal amount of punctuation that can be inferredfrom the input punctuation.

    5.2 Pass InvariantsPass invariants define the allowed output for a streamiterator after seeing a prefix of the input. Pass invariantshave the form:

    tsOut ¼ cpassðts1; ps1; . . . ; tsn; psnÞ;where tsOut represents tuples that can be output, giventuples tsj and punctuations psj that have arrived from thejth input so far. Table 2 lists some nontrivial passinvariants.

    Two pass invariants require further explanation. Thegroup-by iterator can output a result when all tuples havebeen received for that group. Some kinds of punctuationsdetermine which groups are complete. The groupPsfunction in the group-by pass invariant returns those kindsof punctuations. In the auction example, we group on items.If a punctuation arrives that says all tuples have arrived foritems #1001 and #1004, then results for those groups can beoutput. However, if a punctuation arrives that says alltuples have arrived for seller #9932, no results can beoutput.

    In order for sort to output correct results early, we need toknow when the values that appear first in sort order havearrived. Punctuations that match a prefix of the final sortedoutput give us this information. The init function returnspunctuations based on the sort order and the input punctua-tions such that no tuple can still arrive that would be sortedbefore tuples that match those punctuations. In the ware-house example, suppose we have a query that sorts its inputon the hour attribute in ascending order. If we receive apunctuation that reads< �; ½2; 4�; �; � > (recall the schema is< sid; hour; minute; currtmp > ), then we cannot outputanything. If we later receive a punctuation that reads< �; ½0; 3�; �; � > , then we can output results through thefourth hour.We know by the attribute’s type that 0 is the firstvalue for the sorted output. Theinit function, given the two

    punctuations shown above, will return < �; ½0; 4�; �; � > .

    5.3 Propagation InvariantsPropagation invariants specify what punctuations can beoutput by a stream iterator. Propagation invariants have theform:

    psOut ¼ cpropðts1; ps1; . . . ; tsn; psnÞ;where psOut represents punctuations that can be outputgiven tsj and psj. Propagation invariants assume thecorresponding pass invariant has already been satisfied.Table 3 lists propagation invariants. We consider union tobe a combination of merge and dupelim.

    The propagation invariant for project outputs punctua-tions returned by projPs. Output punctuations must havethe same structure as output tuples. If the stream iterator isprojecting out attributes, then the same attributes must beprojected out of punctuations. However, we cannot simplymodify all punctuations. If an attribute being projected outcontains a pattern that is not the wildcard, then thepunctuation cannot be output. (We are developing a moreinformative propagation invariant that attempts to combinepatterns in projected-away attributes to get a wildcard.) Theinvariant for join uses modPs1 and modPs2. They are similar,so we focus on modPs1. Like project, the structure of outputpunctuations must be modified to match output tuples. ThemodPs1 function modifies tuples from one join input,appending attributes from the other input with wildcards.

    5.4 Keep InvariantsKeep invariants specify the state a stream iterator mustpreserve, which will be a subset of the state preserved in thenonpunctuated case. Unlike pass invariants, we specify oneinvariant for each input of an iterator. They have the form:

    tsOut ¼ ckeepjðts1; ps1; . . . ; tsn; psnÞ;

    where ckeepj specifies the state kept for the jth input giventsj and psj are as defined before. Table 4 lists nontrivialkeep invariants.

    The keep invariant for join uses a function calledjoinPs. It returns punctuations with wildcards for allattributes not participating in the join. Thus, join only keepstuples that do no match punctuations from the other inputin states that describe only the join attribute(s).

    5.5 The Minimality ConditionIn addition to the specific behavior invariants for each kindof operator, we assume an additional condition on iteratorimplementations. The minimality condition states that aniterator never produces more output than needed to satisfyits behavior invariants. This condition is necessary to

    TUCKER ET AL.: EXPLOITING PUNCTUATION SEMANTICS IN CONTINUOUS DATA STREAMS 7

    TABLE 2Pass Invariants for Traditional Query Operators

    TABLE 3Propagation Invariants for Traditional Query Operators

  • prevent an operator from gratuitously repeating an outputtuple after punctuation matching that tuple has beenemitted. We note that it is generally straightforward toprove that iterators defined in our framework observe theminimality condition. We henceforth assume that all streamiterators satisfy the minimality condition.

    5.6 Proving Correctness of Stream IteratorsWe prove sdupelim is faithful and proper and we providea portion of our proof for sdiff. Our general strategy forsuch proofs is to specify cumulative invariants and showthat any stream iterators that obey these cumulativeinvariants are faithful and proper, then show that ourparticular iterator implementation obeys the cumulativeinvariants. This two-stage approach allows us some flex-ibility in the implementation of our iterators. We only haveto prove once that any iterator satisfying the invariants isfaithful and proper relative to its relational counterparts.Then, for each implementation of a particular iterator, weonly have to prove it conforms to the invariants for thatiterator to have a complete proof.

    Theorem 1. The stream iterator sdupelim is proper andfaithful to dupelim.

    Proof. Consider the cumulative invariants for dupelim:

    cpassðts; psÞ ¼ �ðtsÞcpropðts; psÞ ¼ psckeepðts; psÞ ¼ ts� setMatchðts; psÞ

    We will first show that any stream iterator thatconforms to these invariants and theminimality conditionis faithful and proper to dupelim. We then show that theparticular implementation of sdupelim given in Section4.2 conforms to the invariants. For this proof, it is useful todenote the tuples and punctuations present in the first islices of input. We use the notation tsi ¼ tupsðS½i�Þ andpsi ¼ punctsðS½i�Þ, where S is the input stream. Also, forj > i, let tsij ¼ tupsðS½i ! j�Þ.

    As noted earlier, any monotone relational operatorsuch as dupelim has a faithful stream counterpart. Ifckeepðts; psÞ ¼ ts, we would have the “standard”faithful version. We need to show for faithfulness thatretaining less state does not change the output. Considerwhat is output between two points i and j (assumingminimality):

    cpassðtsjÞ � cpassðtsiÞ ¼ �ðtsjÞ � �ðtsiÞ¼ �ðtsj � tsiÞ¼ �ðtsij � tsiÞ;since tsj ¼ tsijþþ tsi:

    This equivalent expression indicates how state is usedin an iterator implementation: Past input is kept andused to filter subsequent input. So, the question is, whatis output if our state is per ckeep:

    �ðtsij � ckeepðtsi; psiÞÞ¼ �ðtsij � ðtsi � setMatchTsðtsi; psiÞÞÞ¼ �ððtsij � tsiÞ [ ðtsij \ tsi \ setMatchTsðtsi; psiÞÞÞ½since A� ðB� CÞ ¼ ðA� BÞ [ ðA \ B \ CÞ�

    ¼ �ððtsij � tsiÞ [ ;Þ½since tsij and setMatchTsðtsi; psiÞcan have no tuples in common�

    ¼ �ðtsij � tsiÞ:

    This value is the same as the standard version, soreducing state per ckeep does not affect faithfulness.

    For propriety, we see that punctuations emitted bystage i are all the punctuations received, namely psi.Can a tuple t such that setMatchðt; psiÞ be emittedafter stage i? If so, it is emitted by some stage j > i.So, it must be that t 2 cpassðtsj; psjÞ. So, t 2 tsj.However, t =2 tsij, by grammaticality of the input.Hence, t 2 tsi, and t 2 cpassðtsi; psiÞ. So, t mustalready be emitted at stage i, and by the minimalitycondition, will not be output again later. Thus, theoutput of any iterator satisfying cpass and cprop isgrammatical given grammatical input, and is thereforeproper.

    Conformance: We show that sdupelim conforms tothe invariants, hence is faithful. First, we show that theoutput at each iteration i+1 (call it incrtsiþ1) isequivalent to the pass rule at i+1 minus the pass rulefor the previous iteration i. That is,

    incrtsiþ1 ¼ cpassðtsiþ1; psiþ1Þ � cpassðtsi; psiÞ:

    Note the output tuples at any iteration are tuplesreturned by step and pass. The state value in ourproof is denoted as sti. New tuples and punctuationsarriving at slice i are denoted as tsNewi and psNewi,therefore

    tsi [ tsNewiþ1 ¼ tsiþ1and

    psi [ psNewiþ1 ¼ psiþ1:

    Pass:

    incrtsiþ1 ¼ stepðtsNewiþ1; stiÞþ þ passðpsNewiþ1; stiÞ¼ �ðtsNewiþ1 � stiÞþ þ ½ �¼ �ðtsNewiþ1 � ðtsi � setMatchTsðtsi; psiÞÞÞ¼ �ððtsNewiþ1 � tsiÞ [ ðtsNewiþ1 \ tsi \

    setMatchTsðtsi; psiÞÞÞ½since A� ðB� CÞ ¼ ðA� BÞ [ ðA \ B \ CÞ�

    ¼ �ððtsNewiþ1 � tsiÞ [ ;Þ½since tsNewiþ1 and setMatchTsðtsi; psiÞhave no common tuples�

    ¼ �ðtsNewiþ1 � tsiÞ¼ cpassðtsiþ1; psiþ1Þ � cpassðtsi; psiÞ

    ½from the equality shown earlier�:

    8 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003

    TABLE 4Keep Invariants for Traditional Query Operators

  • Showing conformance to cprop is trivial sincesdupelim outputs punctuations as they arrive, and sois omitted. To prove conformance to ckeep, we show byinduction that if the current state at any stage i equalsckeepðtsi; psiÞ, then the result of keepðpsNewiþ1; stiÞ isckeepðtsiþ1; psiþ1Þ.

    Base case: i ¼ 0, so tsi ¼ psi ¼ ½ �, and the initial statest0 ¼ ½ �. Then:

    keepððst0 [ tsNew1Þ; psNew1Þ¼ keepðð½ � [ tsNew1Þ; ð½ � [ psNew1ÞÞ¼ keepððts0 [ tsNew1Þ; ðps0 [ psNew1ÞÞ¼ keepðts1; ps1Þ¼ ts1 � setMatchTsðts1; ps1Þ¼ ckeepðts1; ps1Þ:

    Induction step: Assume sti ¼ ckeepðtsi; psiÞ. Showthat keepðpsNewiþ1; stiÞ ¼ ckeepðtsiþ1; psiþ1Þ.

    keepðpsNewiþ1; ðsti [ tsNewiþ1ÞÞ

    ¼ ðsti [ tsNewiþ1Þ � setMatchTsððsti [ tsNewiþ1Þ;

    psNewiþ1Þ

    ¼ ðckeepðtsi; psiÞ [ tsNewiþ1Þ�

    setMatchTsððckeepðtsi; psiÞ [ tsNewiþ1Þ; psNewiþ1Þ

    ¼ ðtsiþ1 � setMatchTsðtsi; psiÞÞ�

    setMatchTsððtsiþ1�setMatchTsðtsi; psiÞÞ; psNewiþ1Þ

    ½By properties of [ and \�

    ¼ ðtsiþ1 � setMatchTsðtsi; psiÞÞ�

    setMatchTsðtsiþ1; psNewiþ1Þ � setMatchTsðtsi; psiÞ

    ½Consequence of the definition of setMatchTs�

    ¼ ðtsiþ1 � setMatchTsðtsi; psiÞÞ�

    setMatchTsðtsiþ1; psNewiþ1Þ

    ¼ tsiþ1 � ðsetMatchTsðtsi; psiÞ[

    setMatchTsðtsiþ1; psNewiþ1ÞÞ

    ½Consequence of the definition of setMatchTs�

    ¼ tsiþ1 � setMatchTsððtsi [ tsiþ1Þ; ðpsi [ psNewiþ1ÞÞ

    ¼ tsiþ1 � setMatchTsðtsiþ1; psiþ1Þ

    ¼ ckeepðtsiþ1; psiþ1Þ:ut

    Theorem 2. The stream iterator sdiff is faithful to the

    relational operator difference.

    We present here only the faithfulness part of our proof,

    which, unlike Theorem 1, is nontrivial. Our pass invariant

    for difference is:

    cpassðlts; lps; rts; rpsÞ ¼½tjt 2 lts ^ t =2 rts ^ setMatchðt; rpsÞ�:

    Here, we use the “l” and “r” prefix to distinguish left andright inputs. Thus, ltsi and lpsi are analogs to tsi and psifor the left input and, similarly, rtsi and rpsi for the right.

    Faithfulness (safety):We need to show that at any stage i

    cpassðltsi; lpsi; rtsi; rpsiÞ � ðltsiþþ lsÞ � ðrtsiþþ rsÞ

    for any Lists ls, rs where setMatchTsðls; lpsiÞ ¼ ½ � andsetMatchTsðrs; rpsiÞ ¼ ½ �. Suppose t is a tuple in the left-hand side above. It must be that t 2 ltsi, t =2 rtsi, andsetMatchðt; rpsiÞ. Therefore, t 2 ltsiþþ ls.Wehave t =2 rssince itmatches somepunctuation inrpsi. So, t =2 rtsiþþ rs.Thus, t is in ðltsiþþ lsÞ � ðrtsiþþ rsÞ and the contain-ment is proven.

    Fa i th fu lnes s ( comple t enes s ) : Suppose t 2ðltsiþþ lsÞ � ðrtsiþþ rsÞ for every ls and rs where

    setMatchTsðls; lpsiÞ ¼ setMatchTsðrs; rpsiÞ ¼ ½ �:

    Choosing ls to be [], we must have

    t 2 ðltsiþþ ½�Þ � ðrtsiþþ rsÞ;

    hence t 2 ltsiþþ ½ � and, thus, t 2 ltsi. We know t =2 rtsi,otherwise, it would be in rtsiþþ rs. Now, consider anytuple s where setMatchðs; rpsiÞ ¼ False. We must havet 2 ðltsiþþ ½ �Þ � ðrtsiþþ ½s�Þ, hence t =2 rtsiþþ ½s�, sot 6¼ s. Thus, setMatchðt; rpsiÞ ¼ True. Since t 2 ltsi,t =2 rtsi, and setMatchðt; rpsiÞ, we have

    t 2 cpassðltsi; lpsi; rtsi; rpsiÞ;

    as required for completeness.The complete proof can be found elsewhere [25].

    6 CONCERNS FOR PUNCTUATING DATA STREAMS

    We have assumed in our examples that punctuationsalready exist in the data stream. We have not addressedhow punctuations are embedded in the first place. Weaddress two main issues: how punctuations get into streamsand how frequently should punctuations be embedded.Before we consider these issues, we compare punctuatedstreams to other techniques proposed to query over datastreams.

    6.1 Punctuated Streams versus Other StreamTechniques

    Many current stream processing systems [9], [16], [24] usefixed windows and sliding windows for the same reasons wepropose punctuated streams: They regulate the size of stateand they allow blocking operators to emit results before theend of the stream. With fixed windows, stream inputs aredivided into consecutive subsets, which can be markedexplicitly with landmarks or implicitly with specific datavalues. In the warehouse example, we could implicitlydefine the end of a window at the end of each hour. Slidingwindows allow query operators to process a boundedinterval of tuples. When new tuples arrive, old tuples arediscarded and the operator computes over the currentwindow of tuples.

    When a complete window (sliding or fixed) of tuples isavailable, a query operator computes its result for thatwindow and emits the result. The operator then clears out

    TUCKER ET AL.: EXPLOITING PUNCTUATION SEMANTICS IN CONTINUOUS DATA STREAMS 9

  • any state it might be maintaining for that window and startsover with the next window. In starting over, the semantics

    of some query operators change. For simple operators, suchas select and project, the semantics remain the same. Tuples

    are processed and output immediately. However, morecomplex operators only process the current window, and

    not the entire data set. The group-by operator only groupswithin the current window rather than the entire input, and

    dupelim only removes duplicates within the window.Operators that exploit punctuations in a data stream may

    be able to process the entire stream. Group-by groups theentire input, and dupelim removes duplicates from the

    entire input.Windows also add complexity to many operators, espe-

    cially operators that accept more than one input. N-ary

    operators such as merge and join must maintain thesemantics of the windows over all inputs. Suppose in the

    warehouse example we had only one sensor reportingtemperatures. It would be straightforward to use the value

    of the hour attribute to denote a fixed window. Then, wegroup the input data on the hour attribute and output the

    maximum temperature when the hour attribute changes.However, if we have many sensors, we need the merge

    operator to combine all input streams.Mergemust wait untilit receives the end of a window from all inputs before

    outputting the end of the window. Data that pertains to theoriginal window is output, but data that pertains to the new

    window must be held in state until all data for the currentwindowhas arrived fromall inputs. This behavior introduces

    latency in the merge operator.Sequence database systems [22] could also solve the

    warehouse query since it is time-based. Sequence database

    systems require the stream be globally sorted on sensortime. To preserve order throughout the query, each

    operator’s output must be sorted on the sequence attribute.Therefore, n-ary operators must do extra work to maintain

    the sort order.The auction example cannot be solved with either

    technique. In that example, we join bids and items on

    itemid. A join operator in a sequence database joins on thesequence value and cannot be used. Further, the items for

    sale in an online auction do not align neatly into a window.Some items may sell sooner than others. Punctuated

    streams is the only technique we are aware of that can givecompletely accurate results to this query.

    6.2 Embedding Punctuations in Data Streams

    We have discussed how punctuations embedded into a datastream can assist stream iterators. So far, we have ignored

    how punctuations get into a data stream. Let us suppose alogical operator existed that embedded punctuations, and

    could be placed in a variety of places: at the stream source,at the edge of the query processor, or after query operators

    within the query itself. We will call this operator thepunctuate operator.

    There are many different schemes we could use to

    implement the punctuate operator. Which scheme to choosedepends on where the information resides for generating

    the punctuation. We list several possibilities below:

    Source or sensor intelligence. As data items in a stream are

    often generated, the source may know enough to emit

    punctuation. Sources in the warehouse example (Exam-

    ple 1) were emitting data based on time. When an hour

    ended, the sensor emitted punctuation that all reports for

    that time period have been output.

    Knowledge of access order. Scan or fetch operations may

    know something about the source and generate punctua-

    tions based on that knowledge. For example, if scan is

    able to use an index to read a source, it may use

    information from that index to tell when all values for an

    attribute have been read.

    Knowledge of stream or application semantics. A punc-

    tuate operator may know something about the semantics

    of its source. In the warehouse example, the temperature

    sensors likely have temperature limits. Suppose the

    limits are 20F and 95F. A punctuate operator can output

    punctuations that say there will not be any temperature

    reports above 95F and there will not be any reports

    below 20F.

    Auxiliary information. Punctuation may be genereated

    from sources other than the input stream, such as

    relational tables or other files. In the warehouse example,

    we might have a list of all the sensor units. A punctuate

    operator could use that list to determine when all sensor

    reports for a particular hour have arrived and embed the

    punctuation. This approach can remove punctuation

    logic from the sensors.

    Stream iterator semantics. Some stream iterators impose

    semantics on output tuples. The select iterator, for

    example, can embed a punctuation that no tuples will

    appear in the stream that would fail its selection

    predicate. Additionally, the sort iterator can embed

    punctuations based on its sort order. When it emits a

    tuple, it can follow it with a punctuation stating that no

    more tuples will appear that precede that tuple accord-

    ing to the sort order.

    6.3 Frequency of Punctuations

    There is an obvious trade off in how often to embed

    punctuations in a data stream. If punctuations arrive

    frequently, then blocking operators can output data more

    often, and unbounded stateful operators are able to keep

    less state. However, punctuations also take up bandwidth

    in the data stream and, so, slow the arrival rate of tuples.

    This flexibility is an advantage of punctuations over other

    more static approaches. If the system executing a query

    over the data stream has a large amount of resident

    memory, then punctuations can be emitted less frequently.

    However, if the system executing a query over the data

    stream has a small amount of memory, such as a wireless

    telephone, then the number of punctuations will have to

    increase to minimize the amount of state required by the

    query. We are working on formal descriptions of the effects

    of different punctuation schemes over entire queries.

    10 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003

  • 7 PROTOTYPE IMPLEMENTATION

    To understand the complexity of implementing punctua-tions and their effect on performance, we used the NiagaraQuery Engine [18], which queries XML data. We defined apunctuation format for XML and enhanced some ofNiagara’s operators to exploit punctuation. We thensimulated the warehouse example.

    7.1 XML Punctuation Format

    We have three goals in designing our XML punctuationformat: First, punctuation size should be similar to the sizeof the tuples it describes. Second, punctuations should notaffect the results of iterators that do not process punctua-tions. Third, iterators that do understand punctuationsshould be able to easily determine which tuples match apunctuation.

    We achieve these goals using the Namespaces for XMLrecommendation [5]. We define a namespace called punctand define an element in it that mirrors a tuple structure.Iterators will not confuse punctuations with tuples sincethey are in a different namespace. For example, givenelements of tempdata, we define punctuation elementspunct:tempdata. Samples of an XML tuple and punctua-tion follow:

    tuple punctuation S01 �17 ½17;20Þ30 �77 �

    7.2 Enhancements to Niagara Operators

    The query (in SQL) for this experiment is as follows:

    SELECT MAXðcurrtmpÞAS maxtemp; hour FROMSELECT currtmp; hour FROM sensor1 UNION

    SELECT currtmp; hour FROM sensor2

    GROUP BY hour;

    7.2.1 Union

    The union operator in Niagara performs duplicate elimina-tion, so it is an unbounded stateful operator. Tuples thathave arrived are stored in a hash table. If a new tuplearrives that is already in the hash table, it is not output. If itis not in the hash table, it is output and added to the hashtable. When union receives punctuations from all inputsthat match the same set of tuples, it removes tuples in thehash table that match the punctuations. Then, union passesthe punctuation to the next stream iterator. As we havediscussed, punctuations output from union must agree withpunctuations received from all inputs.

    7.2.2 Group-By

    Group-by is both a blocking and an unbounded statefuloperator. We use punctuations to output results early andto reduce state size. Group-by must wait until it has readthe entire input to ensure that no more values appear for a

    group. However, if a punctuation arrives that guarantees

    that all tuples for a given group have been seen, we can

    output the result for that group early. In the warehouse

    simulation, we are grouping on the hour attribute. There-

    fore, when a punctuation arrives guaranteeing that no more

    tuples will arrive for a particular hour we can output the

    result for that hour along with corresponding punctuation.

    Further, we can use that same punctuation to reduce the

    state for that group.

    7.2.3 Join

    The Niagara Query Engine uses two implementations for

    the join operator: nested loops and symmetric hash join

    [27]. The symmetric hash join implementation is more

    appropriate for queries over data streams since it does

    not block on either input. We implement symmetric hash

    join using one hash table for each input. Tuples are

    stored in the appropriate hash table as they arrive, then

    used to probe the other hash table to determine if there

    are new tuples to output. The hash key is based on the

    value of the join attributes for each tuple. Thus, the hash

    tables can grow without bound. We use punctuations to

    decide when tuples can be removed from hash tables,

    according to the keep invariant for join shown earlier in

    Table 4. If a punctuation arrives from one input

    specifying that all tuples have arrived for a particular

    set of join attribute values, then we remove tuples from

    the hash table for the other input using the join values

    described by the punctuation as the hash key.

    7.3 Results

    We simulated sensors with Java applications that stream

    data into the Niagara Query Engine. These sensors output

    tuples as described earlier, reporting the current tempera-

    ture at that sensor every minute. For these tests, we varied

    the frequency of embedded punctuations from 0 to 30 per

    hour. We wanted to evaluate the performance cost of

    embedding punctuations into data streams. Thus, our

    sensor applications output data immediately, rather than

    outputting a single data item every minute. The data was

    over 60 hours.We see from Fig. 2a that the amount of memory used by

    the hash table in union is greatly reduced. If the stream is

    not punctuated, the size of the hash table grows until the

    stream ends. If the stream is punctuated, the size of the hash

    table is much smaller since tuples are removed from state

    that match punctuations.We see from Fig. 2b that embedding punctuations in the

    stream unblocks group-by, allowing it to output results

    early. Without punctuations, the operator must wait until

    the input has completed before outputting results. We also

    see that embedding punctuations does not affect the overall

    performance of the query. In fact, when using a minimal

    number of punctuations, the performance improves. This

    improvement is because the hash table used by union is

    smaller when punctuations exist in the data stream.

    Without punctuations, the hash table grows, forcing more

    frequent memory allocations.

    TUCKER ET AL.: EXPLOITING PUNCTUATION SEMANTICS IN CONTINUOUS DATA STREAMS 11

  • 8 RELATED WORK

    Data stream processing systems have been researched for anumber of years, though interest has increased recently.The Tangram stream query processing system by Parkeret al. [20] is an early investigation attempting to usedatabase technology on a data stream. They discuss anumber of stream transducer implementations. Theyinclude blocking relational operators such as sort anddifference, but do not discuss how these behave in thepresence of continuous streams. Parker also discusses inmore detail a model for stream transducers [19] that is verysimilar to the one we present, though he limits thediscussion to unary stream transducers and does notaddress how they interact with continuous data streams.

    In the architecture describe by Babu et al. [4], a queryover a data stream has: one or more input streams, anoutput stream, a store for holding tuples that might be partof the result, and a scratch for holding state. Punctuationscould enhance this architecture in two ways: First,implementing pass invariants could reduce the size of storeby outputting tuples sooner. Second, implementing keepinvariants could reduce the size of scratch.

    Like the Tangram system, most stream database systemsuse a window or summarization scheme to handle blockingand unbounded stateful operators. The Tribeca system [24]is another early example of such a system. The authorsintroduce a high-level query language for data streams, butadd operators specifically for defining stream windows.The system discussed by Madden and Franklin [16]implements operators that efficiently combine data fromstatic (file-based) and streaming sources. Additionally, theyhave enhanced their adaptive query processing system [3]to support queries over data streams [17]. Finally, work onthe Aurora system [6] investigates optimization tactics forqueries over data streams and ways to intelligently shedload when the system is about to run out of memory.

    Work on partial results by Shanmugasundaram et al. [23]specifically addresses blocking operators. In their system,query operators waiting for output from other operators canrequest a partial result. Online computation work [13] also

    addresses blocking operators by reporting partial results atregular intervals. The user interface reports progress with aconfidence interval and allows users to cancel queries whenthe result is “good enough.” A priori knowledge of inputdata is required to determine the confidence level andinterval. Punctuations in a data stream could be used topresent that knowledge to the query.

    Arasu et al. [2] specifically address the problem ofunbounded stateful operators. They propose an algorithmto determine if a given select-project-join query can beprocessed in bounded memory for all possible inputs. Incases where the query can be processed in boundedmemory, their algorithm also produces an evaluation planfor the query, characterizing the memory requirements.Their discussion is limited to the select, project, and joinoperators and does not address other operators such asunion, set difference, and grouping.

    9 CONCLUSIONS AND FUTURE WORK

    We have presented a novel way to execute queries oncontinuous data streams. Our method improves manytraditional relational operators, specifically targeting block-ing and unbounded stateful operators. We define streamiterators as a foundation for our work and describe aspecific framework for modeling stream iterators oncontinuous data streams. We define desirable propertiesfor stream iterators and give proofs that our invariants meetthose properties for two operators and that the correspond-ing iterators satisfy the invariants.

    There is more work to be done in this area. We need toexpand our formal model and prove invariants for moreoperators, as well as prove the iterators defined in ourframework satisfy the invariants. We also need to makemore Niagara operators aware of punctuations, to furthershow the practicality of our approach.

    The punctuations we present here are strict—they saythat no more tuples will arrive matching a punctuationfrom the stream. A more relaxed punctuation might tell anoperator that there will not be any matching tuples arrivingafter it for an extended time. Operators could use thatinformation to enhance buffer eviction policies. Tuples that

    12 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003

    Fig. 2. (a) The state held by union as tuples arrive. The dotted line shows the size of state when punctuations are present and the solid line shows the

    size of state without punctuations. (b) Query Performance. The dashed line indicates when the first results are emitted and the solid line is the total

    time to execute the query.

  • are not needed for a while are good candidates forswapping to disk. For example, the XJoin implementation[26] might be able to use this kind of punctuation todetermine which partition can be written to disk. Anotherkind of punctuation might convey a constraint about thedata that is about to arrive, such as a sort order or a boundon the range of a particular attribute.

    Another use for punctuations is to declare informationabout the arriving data, rather than the data that has beenseen. For example, Fegaras et al. [8] use annotations in thedata stream to declare the incoming data structure, andwhether the data fragment following the annotation is arepeat or an update. One could pursue this direction furtherto specify other constraints, such as a sort order overparticular attributes or even attribute domains.

    One issue we ran into during the implementation phasewas in evaluating our work. We presented some results thatshow output arriving early and decreased state throughoutthe execution of the query, but how do we compare ourwork to other stream processing systems? How do we knowwhat “good” performance is? We are designing a bench-mark for stream processing systems based on the scenarioin XMark [21].

    Another interesting direction is to be able to determine,given a query over a data stream, whether a givenpunctuation scheme will be helpful. Stream generatorsmay be able to output different kinds of punctuation to aquery. We would like to be able to determine which wouldbe most beneficial.

    There is common work with partial evaluation of queries[13], [23]. Both address applying blocking operators to longor continuous inputs. Punctuation might be used to helppartial operators communicate output that is “partial”versus output that is “correct,” or assist in computinghow close we are to the “correct” output.

    ACKNOWLEDGMENTS

    The authors would like to thank Kristin Tufte and VassilisPapadimos for the discussions they had, Levent Erkok forhis help in developing the Haskell framework, JenniferWidom and Samuel Madden for their comments, RaghuRamakrishnan for his pointers to related work, DavidDeWitt for his advice on the direction of this work, and theanonymous reviewers for their comments on this paper.Funding for this work was provided by DARPA throughNAVY/SPAWAR Contract No. N66001-99-1-8908 and bythe US National Science Foundation ITR award IIS0086002.Leonidas Fegaras is supported by the US National ScienceFoundation grant IIS-9811525.

    REFERENCES[1] J. Albert, “Algebraic Properties of Bag Data Types,” Proc. 17th Int’l

    Conf. Very Large Data Bases, pp. 211-219, Sept. 1991.[2] A. Arasu, B. Babcock, S. Babu, J. McAlister, and J. Widom,

    “Characterizing Memory Requirements for Queries over Contin-uous Data Streams,” Proc. 21st ACM SIGACT-SIGMOD-SIGARTSymp. Principles of Database Systems, pp. 221-232, June 2002.

    [3] R. Avnur and J.M. Hellerstein, “Eddies: Continuously AdaptiveQuery Processing,” Proc. ACM SIGMOD Int’l Conf. Management ofData, pp. 261-272, May 2000.

    [4] S. Babu and J. Widom, “Continuous Queries over Data Streams,”SIGMOD Record, vol. 30, no. 3, Sept. 2001.

    [5] Namespaces in XML. T. Bray, D. Hollander, and A. Layman,eds., World Wide Web Consortium, http://www.w3.org/TR/REC-xml-names/, Jan. 1999.

    [6] D. Carney, U. Cetintemel, M. Cherniack, C. Convey, S. Lee, G.Seidman, M. Stonebraker, N. Tatbul, and S. Zdonik, “MonitoringStreams—A New Class of Data Management Applications,” Proc.28th Int’l Conf. Very Large Data Bases, Aug. 2002.

    [7] C. Cortes, K. Fisher, D. Pregibon, A. Rogers, and F. Smith,“Hancock: A Language for Extracting Signatures from DataStreams,” Proc. Sixth Int’l Conf. Knowledge Discovery and DataMining, pp. 9-17, Aug. 2000.

    [8] L. Fegaras, D. Levine, S. Bose, and V. Chaluvadi, “QueryProcessing of Streamed XML Data,” Proc. 11th Int’l Conf.Information and Knowledge Management, Nov. 2002.

    [9] J. Gehrke, F. Korn, and D. Srivastava, “On Computing CorrelatedAggregates over Continuous Data Streams,” Proc. ACM SIGMODInt’l Conf. Management of Data, pp. 13-24, May 2001.

    [10] A.C. Gilbert, Y. Kotidis, S. Muthukrishnan, and M.J. Strauss,“Surfing Wavelets on Streams: One-Pass Summaries for Approx-imate Aggregate Queries,” Proc. 27th Int’l Conf. Very Large DataBases, pp. 79-88, Sept. 2001.

    [11] G. Graefe, “Query Evaluation Techniques for Large Databases,”ACM Computing Surveys, vol. 25, no. 2, 1993.

    [12] T. Hallgren and M. Carlsson, “Fudgets,” PhD thesis, ChalmersUniv. of Technology, Mar. 1998.

    [13] J.M. Hellerstein, P.J. Haas, and H.J. Wang, “Online Aggregation,”Proc. ACM SIGMOD Int’l Conf. Management of Data, pp. 171-182,June 1997.

    [14] P. Hudak, The Haskell School of Expression: Learning FunctionalProgramming through Multimedia. Cambridge Univ. Press, 2000.

    [15] B.K. Livezey and R.R. Muntz, “ASPEN: A Stream ProcessingEnvironment,” Proc. Conf. Parallel Architectures and LanguagesEurope, pp. 374-388, 1989.

    [16] S. Madden and M.J. Franklin, “Fjording the Stream: AnArchitecture for Queries over Streaming Sensor Data,” Proc. 18thIEEE Int’l Conf. Data Eng., pp. 555-566, Feb. 2002.

    [17] S. Madden, M. Shah, J.M. Hellerstein, and V. Raman, “Con-tinuously Adaptive Continuous Queries over Streams,” Proc.ACM SIGMOD Int’l Conf. Management of Data, pp. 49-60, June2002.

    [18] J. Naughton, D. DeWitt, D. Maier, J. Chen, L. Galanis, K. Tufte, J.Kang, Q. Luo, N. Prakash, and F. Tian, “The Niagara QuerySystem,” The IEEE Data Eng. Bull., vol. 24, no. 2, pp. 27-33, June2000.

    [19] D.S. Parker, “Stream Data Analysis in Prolog,” The Practice ofProlog, L. Sterling, ed., chapter 8, MIT Press, 1990.

    [20] D.S. Parker, R.R. Muntz, and L. Chau, “The Tangram StreamQuery Processing System,” Proc. Fifth IEEE Int’l Conf. Data Eng.,Feb. 1989.

    [21] A. Schmidt, F. Waas, M. Kersten, D. Florescu, I. Manolescu, M.J.Carey, and R. Busse, “The XML Benchmark Project,” TechnicalReport INS-R0103, Centrum voor Wiskunde en Informatica, Apr.2001.

    [22] P. Seshadri, M. Livny, and R. Ramakrishnan, “Sequence QueryProcessing,” Proc. ACM SIGMOD Int’l Conf. Management of Data,pp. 430-441, May 1994.

    [23] J. Shanmugasundaram, K. Tufte, D. J. DeWitt, J. Naughton, and D.Maier, “Architecting a Network Query Engine for ProducingPartial Results,” WebDB (Informal Proceedings), pp. 17-22, May2000.

    [24] M. Sullivan and A. Heybey, “Tribeca: A System for ManagingLarge Databases of Network Traffic,” Proc. 1998 USENIX Ann.Techincal Conf., June 1998.

    [25] P. Tucker, D. Maier, T. Sheard, and L. Fegaras, “EnhancingRelational Operators for Querying over Punctuated DataStreams,” http://www.cse.ogi.edu/dot/niagara/pstream/punctuating.pdf., 2002.

    [26] T. Urhan and M.J. Franklin, “Xjoin: A Reactively-ScheduledPipelined Join Operator,” The IEEE Data Eng. Bull., vol. 23, no. 2,pp. 27-33, June 2000.

    [27] A.N. Wilschut and P.M.G. Apers, “Dataflow Query Execution in aParallel Main-Memory Environment,” Proc. First Int’l Conf. ofParallel and Distributed Information Systems, pp. 68-77, Dec. 1991.

    TUCKER ET AL.: EXPLOITING PUNCTUATION SEMANTICS IN CONTINUOUS DATA STREAMS 13

  • Peter A. Tucker received the BS degree inmathematics and computer science in 1991 fromWhitworth College (Spokane, WA). He thenworked for eight years at Microsoft Corporationin software development. He is currently in hisfourth year of study at the OGI School ofScience and Engineering at Oregon Health andScience University, pursuing a PhD degree indatabase systems. His technical interests in-clude data stream processing, formal semantics,

    and functional programming.

    David Maier received the BA (Honors College)degree from the University of Oregon, with adouble major in mathematics and computerscience, and the PhD degree from PrincetonUniversity in electrical engineering and computerscience. He is a professor in the Department ofComputer Science and Engineering in the OGISchool of Science and Engineering (formerly theOregon Graduate Institute) at the Oregon Healthand Science University, and previously was on

    the faculty of SUNY Stony Brook. He has held visiting positions at INRIA(Rocquencourt) and University of Wisconsin-Madison. His researchinterests include query processing, object-oriented systems, databasesand data-product management for scientific computing, superimposedinformation systems, and net data management. He is a fellow of ACMand holds the ACM SIGMOD Innovations Award. He is a member of theIEEE and the IEEE Computer Society.

    Tim Sheard graduated with a degree in chem-istry from Harvard in 1979. He received the MSdegree in 1979 from the University of Vermont,and the PhD degree in 1985 from the Universityof Massachusetts at Amherst. His research atfirst investigated database integrity and data-base query languages. In the early 1990’s, hebecame an assistant professor of computerscience at the Oregon Graduate Institute (nowthe Oregon Health and Science University),

    where he began investigating approaches to generic programming.Today he is a strong proponent of the use of functional languages andmetaprogramming systems. He is the principle designer and implemen-ter of the MetaML system.

    Leonidas Fegaras received the PhD degree incomputer science from the University of Massa-chusetts at Amherst in 1993. He is currently anassociate professor of computer science andengineering at the University of Texas atArlington. He was previously a senior researchscientist at the OGI School of Science andEngineering at the Oregon Health and ScienceUniversity. He has contacted research in theareas of database query processing and optimi-

    zation, object-oriented databases, Web databases, database program-ming languages, functional programming, and formal semantics. He is amember of the IEEE Computer Society.

    . For more information on this or any other computing topic,please visit our Digital Library at http://computer.org/publications/dlib.

    14 IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, VOL. 15, NO. 3, MAY/JUNE 2003