1. A method of processing a data stream, comprising: initiating execution of a query that includes the data stream as a data source, wherein the query specifies an invocation pattern for the data stream; and processing tuples in accordance with the query as the tuples are received through the data stream until an indication is received that execution of the query should cease, wherein the data stream is included in the query as a relation-valued function that returns one or more tuples in a return mode based on the invocation pattern, wherein the return mode comprises one of a tuple mode returning one tuple and a set mode returning multiple tuples.