Combining primary rows with Secondary rows based on key column values The stage that perform Horizontal combining are
These Stage differ with each other w. r. t
Description | join | lookup | Merge | ||||
Input Names |
|
||||||
Types of joins | Inner leftouter,right outer, full outer | Inner, leftouter | Inner left outer | ||||
i/p,o/p,rejects |
|
|
|
||||
key column Name requirements | Key column Name should be SAME |
|
Key column name should in SAME | ||||
inner join type |
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
|
|
|
|
||||
memory usage | light | heavy | light |
Cross verification of primary records with Secondary records. It is a processing Stage which performs Horizontal combining In Data stage we have 4 types of look – ups
Look up at memory, that is all the Secondary records are copied to the memory and primary records are cross verified with Secondary records at memory. Sparse look up Look – up at Source , that is each primary record is send to the Source for cross verification. look up, failure condition :-
4 types of joins can be performed
E no | E name | Dept no |
11 | a | 10 |
22 | b | 20 |
33 | c | 30 |
Dept No | D Name | loc |
10 | Account | NY |
20 | Search | OL |
40 | Sales | CH |
Inner Join T1 n T2 = {10, 20} Matched records from primary and Secondary Tables . Left outer join T1 n (t1 u t2) = {10, 20, 30} Matched records from primary and Secondary Tables and unmatched records from primary. Right outer join T2 n (t1 u t2) = {10, 20, 40} Matched records from primary and Secondary Tables and unmatched records from Secondary. Full outer Join T1 u T2 = {10,20,30, 40} Matched and un matched records from primary and secondary table
Eid | Ename | State | Status |
11 | SUMAN | AP | 1001 |
22 | MOON | TN | 1000 |
33 | SumaN | AP | 1111 |
44 | Moon STAR | NN | 1011 |
55 | SUMAN | AP | 1101 |
66 | MooN | JK | 1001 |
77 | MoonSUN | AP | 1011 |
88 | MooN | MP | 1111 |
State | State desc |
Ap | Andhra Pradesh |
TN | TamilNadu |
JK | Jammu Kashmir |
DL | Delhi |
KK | Kenya kumari |
Load primary.txt columns select state Sequential file 0 Load primary.txt columns select state
Drag key column value “State” from primary to ref In ref, for State, Set key = case less (that is case sensitive can look -up)
Key expression | Range | column |
Eid | ||
Ename | ||
State | ||
Status |
Dslink
Derivation | Column Name |
Primary – EID | EID |
Primary- Ename | EName |
Ref.state | State-desc |
Primary- status | Status |
Key expression | Key types | Column name |
State | ||
State-desc |
Click on yellow link on the TOP Constraints Set look up failure = Drop (or) Continue (or) Reject Needs are reject link Output
Interested in mastering DataStage Training? Enroll now for FREE demo on DataStage Training.
Dept (4 rows) [Secondary records are copied to memory, and primary are cross verified with Secondary at memory so, 4 rows] oracle 0 Load dept Set look up Type = Normal oracle 1 Load EMP look up Map key Column Value “Dept no”Drag and drop required columnsSelect continue Compile and RUN (b )Job :- Sparse look up when we need to use Sparse ? Sol:-
Dept (14 rows) [Each primary record is send to the Source that is dept for cross verification So 14 rows] oracle 0 Load dept 1st look – up Type = Sparse o/p Job:- Sparse look up Sequential file If Ref file is Sequential file, then we have an Stage called “Look up file set” extension is .lfs Sequential file 0 :- load ref file Sequential file 1 :- load primary file Look up Map key column value “State”Drag and drop required columnsàSet look – up failure = continueCompile and RUN Look up file set Look up keysKey = State Keep = false Target look up file set = D: /shilpa/new sql look up.lfs Look up Range Range look up = No Options Allow Duplicates = false
Look up file set
Paste the lookup file set in the place of ref SEQ file is (a) In the lookup file set à paste the file name here there is no need to map in the look up first Output
E id | E name | State | Status | State - dense |
11 | SUMAN | AP | 1001 | Andhra Pradesh |
22 | MOON | TN | 1000 | Tamilnadu |
job :- Database Sparse look up In Data base , we can use lookup file set if we have 2 ref Data bases Output Range look up:-
Oracle enterprise 1 Load EMP table convert Sal to integer in EMP table Oracle enterprise 1 Load Sal grade table Convert Grade, lo Sal, HSal to integer in Sal grade table
EMP. Sal >= Sal grade . Lo Sal And EMP. Sal <= Sal grade . H Sal Drag and Drop required columnsclick on constraintsSelect Drop/Continue Data Set PropertiesàFileBrowse for file Range look up .ds Compile and RUN For indepth understanding of DataStage click on
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.