|
The Aggregate node replaces a sequence of input records with summarized, aggregated output
records.
|
Example
node = stream.create("aggregate", "My node")
# dbnode is a configured database import node
stream.link(dbnode, node)
node.setPropertyValue("contiguous", True)
node.setPropertyValue("keys", ["Drug"])
node.setKeyedPropertyValue("aggregates", "Age", ["Sum", "Mean"])
node.setPropertyValue("inc_record_count", True)
node.setPropertyValue("count_field", "index")
node.setPropertyValue("extension", "Aggregated_")
node.setPropertyValue("add_as", "Prefix")
Table 1. aggregatenode properties
aggregatenode properties |
Data type |
Property description |
keys |
list
|
Lists fields that can be used as keys for aggregation. For
example, if Sex and Region are your
key fields, each unique combination of M and F with
regions N and S (four unique combinations)
will have an aggregated record. |
contiguous |
flag |
Select this option if you know that all records with the same
key values are grouped together in the input (for example, if the
input is sorted on the key fields). Doing so can improve performance. |
aggregates |
|
Structured property listing the numeric fields whose values will be aggregated, as well as
the selected modes of aggregation. |
aggregate_exprs |
|
Keyed property which keys the derived field name with the aggregate expression used to
compute it. For example:
aggregatenode.setKeyedPropertyValue
("aggregate_exprs", "Na_MAX", "MAX('Na')")
|
extension |
string |
Specify a prefix or suffix for duplicate aggregated fields
(sample below). |
add_as |
Suffix
Prefix |
|
inc_record_count |
flag |
Creates an extra field that specifies how many input records
were aggregated to form each aggregate record. |
count_field |
string |
Specifies the name of the record count field. |
allow_approximation
|
Boolean
|
Allows approximation of order statistics when aggregation is performed in Analytic Server |
bin_count
|
integer
|
Specifies the number of bins to use in approximation |