Anda di halaman 1dari 3

AGGREGATOR TRANSFORMATION

Connected and Active Transformation The Aggregator transformation allows us to perform aggregate calculations, such as averages and sums. Aggregator transformation allows us to perform calculations on groups. Components of the Aggregator Transformation 1. Aggregate expression 2. Group by port . !orted "nput #. Aggregate cache 1) Aggregate Expressions $ntered in an output port. Can include non%aggregate expressions and conditional clauses. The transformation language includes the following aggregate functions& A'G, C()*T, +A,, +"*, !)+ -".!T, /A!T +$0"A*, 1$.C$*T"/$, !T00$', 'A."A*C$ Single Level Aggregate Function: MAX(SAL) Nested Aggregate Function: MAX( CO N!( "!EM )) Nested Aggregate Functions "n Aggregator transformation, there can be multiple single level functions or multiple nested functions. An Aggregator transformation cannot have both types of functions together. +A,2 C()*T2 "T$+ 33 is correct. +"*2+A,2 C()*T2 "T$+ 333 is not correct. "t can also include one aggregate function nested within another aggregate function Conditional Clauses 4e can use conditional clauses in the aggregate expression to reduce the number of rows used in the aggregation. The conditional clause can be any clause that evaluates to T.)$ or -A/!$. !)+2 C(++"!!"(*, C(++"!!"(* 5 6)(TA 3 Non#Aggregate Functions 4e can also use non%aggregate functions in the aggregate expression. ""-2 +A,2 6)A*T"T7 3 5 8, +A,2 6)A*T"T7 3, 833 $) %roup &' (orts "ndicates how to create groups.

4hen grouping data, the Aggregator transformation outputs the last row of each group unless otherwise specified. The Aggregator transformation allows us to define groups for aggregations, rather than performing the aggregation across all input data. -or example, we can find +aximum !alary for every 0epartment. "n Aggregator Transformation, (pen 1orts tab and select Group 9y as needed. )) sing Sorted "nput )se to improve session performance. To use sorted input, we must pass data to the Aggregator transformation sorted by group by port, in ascending or descending order. 4hen we use this option, we tell Aggregator that data coming to it is already sorted. 4e chec: the !orted "nput (ption in 1roperties Tab of the transformation. "f the option is chec:ed but we are not passing sorted data to the transformation, then the session fails. *) Aggregator Cac+es The 1ower Center !erver stores data in the aggregate cache until it completes Aggregate calculations. "t stores group values in an index cache and row data in the data cache. "f the 1ower Center !erver re;uires more space, it stores overflow values in cache files. Note: The 1ower Center !erver uses memory to process an Aggregator transformation with sorted ports. "t does not use cache memory. 4e do not need to configure cache memory for Aggregator transformations that use sorted ports. 1) Aggregator "ndex Cac+e: The index cache holds group information from the group by ports. "f we are using Group 9y on 0$1T*(, then this cache stores values 18, 28, 8 etc. All Group 9y Columns are in AGG.$GAT(. "*0$, CAC<$. $x. 0$1T*( $) Aggregator ,ata Cac+e: 0ATA CAC<$ is generally larger than the AGG.$GAT(. "*0$, CAC<$. Columns in 0ata Cache& 'ariable ports if any *on group by input=output ports. *on group by input ports used in non%aggregate output expression. 1ort containing aggregate function

13 Exa-ple: !o calculate MAX. M"N. A/% and S M o0 salar' o0 EM( ta1le2 $+1 will be source table. Create a target table $+1>AGG>$,A+1/$ in target designer. Table should contain 0$1T*(, +A,>!A/, +"*>!A/, A'G>!A/ and !)+>!A/ Create the shortcuts in your folder. Creating Mapping: 1. (pen folder where we want to create the mapping. 2. Clic: Tools %5 +apping 0esigner. . Clic: +apping%5 Create%5 Give mapping name. $x& m>agg>example #. 0rag $+1 from source in mapping. ?. Clic: Transformation %5 Create %5 !elect AGG.$GAT(. from list. Give name and clic: Create. *ow clic: done. @. 1ass !A/ and 0$1T*( only from !6>$+1 to AGG.$GAT(. Transformation. A. $dit AGG.$GAT(. Transformation. Go to 1orts Tab B. Create # output ports& ()T>+A,>!A/, ()T>+"*>!A/, ()T>A'G>!A/, ()T>!)+>!A/ C. (pen $xpression $ditor one by one for all output ports and give the calculations. $x& +A,2!A/3, +"*2!A/3, A'G2!A/3,!)+2!A/3 18. Clic: Apply %5 (:. 11. 0rag target table now. 12. Connect the output ports from .an: to target table. 1 . Clic: +apping %5 'alidate 1#. .epository %5 !ave Create !ession and 4or:flow as described earlier. .un the 4or:flow and see the data in target table. +a:e sure to give connection information for all tables.

Anda mungkin juga menyukai