Defines a stateless element that can interpret all operational codes (opcodes): insert, delete and update.
CREATE [ LOCAL | OUTPUT ] DELTA STREAM name [ schema_clause ] primary_key_clause [ local-declare-block ] [partition_clause ] as_clause Query;
name |
The name of the delta stream being created. |
schema_clause |
Schema definition for new windows. If no schema clause is specified, it can be derived from the query. |
primary_key_clause |
Set primary key. See PRIMARY KEY Clause for more information. |
local-declare-block |
(Optional) A declaration of variables and functions that can be accessed in the query. |
partition_clause |
(Optional) Creates a specified number of parallel instances of the delta stream. The partition type specifies how to partition the input for the delta stream. See the PARTITION BY Clause for more information. |
as_clause |
Introduces query to statement. |
Query |
A query implemented in a statement. See Queries for more information. |
A delta stream is a stateless element that can understand all opcodes. A delta stream can be used when a computation, filter, or union must be performed on the output of a window, but a state does not need be maintained.
See the <xref href="san1311804134032.xml">Using SPLASH in Flex Operators</xref> topic for more details.
This creates a delta stream that computes total cost:
CREATE INPUT WINDOW Trades SCHEMA ( TradeId long, Symbol string, Price money(4), Shares integer ) PRIMARY KEY (TradeId) ; CREATE DELTA stream TradesWithCost PRIMARY KEY DEDUCED AS SELECT trd.TradeId, trd.Symbol, trd.Price, trd.Shares, trd.Price * trd.Shares TotalCost FROM Trades trd ;
This creates a delta stream that filters out records where total cost is less than 10,000:
CREATE DELTA stream LargeTrades PRIMARY KEY DEDUCED AS SELECT * FROM TradesWithCost twc WHERE twc.TotalCost >= 10000 ;