You are on page 1of 16

2/22/2016

Home

InformaticaScenarioBasedInterviewQuestionswithAnswersPart1

DataWarehouse

Informatica

InformaticaScenarios

Oracle

Unix

Hadoop

InformaticaScenarioBasedInterviewQuestionswith
AnswersPart1

Search...

Search

PopularPosts

InformaticaScenarios

SedCommandinUnixandLinuxExamples

Ihavelistedthefollowinginformaticascenarioswhicharefrequentlyaskedinthe

TopExamplesofAwkCommandinUnix

informaticainterviews.Theseinformaticascenariointerviewquestionshelpsyoualotin
gainingconfidenceininterviews.

FindCommandinUnixandLinuxExamples
CutCommandinUnix(Linux)Examples

1.Howtogeneratesequencenumbersusingexpressiontransformation?
Solution:
Intheexpressiontransformation,createavariableportandincrementitby1.Thenassign
thevariableporttoanoutputport.Intheexpressiontransformation,theportsare:
V_count=V_count+1

InformaticaScenarioBasedInterviewQuestionswith
AnswersPart1
DateFunctionsinHive
SQLQueriesInterviewQuestionsOraclePart1

O_count=V_count

GrepCommandinUnixandLinuxExamples

2.Designamappingtoloadthefirst3rowsfromaflatfileintoatarget?

StringFunctionsinHive

Solution:

TypesofDimensionsindatawarehouse

Youhavetoassignrownumberstoeachrecord.Generatetherownumberseitherusingthe
expressiontransformationasmentionedaboveorusesequencegeneratortransformation.
ThenpasstheoutputtofiltertransformationandspecifythefilterconditionasO_count<=3
3.Designamappingtoloadthelast3rowsfromaflatfileintoatarget?

HaveQuestions?FollowMe
vijaybhaskar
Addtocircles

Solution:
Considerthesourcehasthefollowingdata.
col
a
b
c
d
e
Step1:Youhavetoassignrownumberstoeachrecord.Generatetherownumbersusingthe
expressiontransformationasmentionedaboveandcalltherownumbergeneratedportas
O_count.CreateaDUMMYoutputportinthesameexpressiontransformationandassign1

593havemeincircles

Viewall

tothatport.Sothat,theDUMMYoutputportalwaysreturn1foreachrow.
Intheexpressiontransformation,theportsare
V_count=V_count+1
O_count=V_count
O_dummy=1
Theoutputofexpressiontransformationwillbe
col,o_count,o_dummy
a,1,1
b,2,1
c,3,1
d,4,1
e,5,1
Step2:Passtheoutputofexpressiontransformationtoaggregatoranddonotspecifyany
groupbycondition.CreateanoutputportO_total_recordsintheaggregatorandassign

http://www.folkstalk.com/2011/06/informaticascenariobasedinterview.html

1/4

2/22/2016

InformaticaScenarioBasedInterviewQuestionswithAnswersPart1

O_countporttoit.Theaggregatorwillreturnthelastrowbydefault.Theoutputofaggregator
containstheDUMMYportwhichhasvalue1andO_total_recordsportwhichhasthevalueof
totalnumberofrecordsinthesource.
Intheaggregatortransformation,theportsare
O_dummy
O_count
O_total_records=O_count
Theoutputofaggregatortransformationwillbe
O_total_records,O_dummy
5,1
Step3:Passtheoutputofexpressiontransformation,aggregatortransformationtojoiner
transformationandjoinontheDUMMYport.Inthejoinertransformationchecktheproperty
sortedinput,thenonlyyoucanconnectbothexpressionandaggregatortojoiner
transformation.
Inthejoinertransformation,thejoinconditionwillbe
O_dummy(portfromaggregatortransformation)=O_dummy(portfromexpression
transformation)
Theoutputofjoinertransformationwillbe
col,o_count,o_total_records
a,1,5
b,2,5
c,3,5
d,4,5
e,5,5
Step4:Nowpasstheouputofjoinertransformationtofiltertransformationandspecifythe
filterconditionasO_total_records(portfromaggregator)O_count(portfromexpression)<=2
Inthefiltertransformation,thefilterconditionwillbe
O_total_recordsO_count<=2
Theoutputoffiltertransformationwillbe
colo_count,o_total_records
c,3,5
d,4,5
e,5,5
4.DesignamappingtoloadthefirstrecordfromaflatfileintoonetableA,thelastrecord
fromaflatfileintotableBandtheremainingrecordsintotableC?
Solution:
Thisissimilartotheaboveproblemthefirst3stepsaresame.Inthelaststepinsteadof
usingthefiltertransformation,youhavetouseroutertransformation.Intherouter
transformationcreatetwooutputgroups.
Inthefirstgroup,theconditionshouldbeO_count=1andconnectthecorrespondingoutput
grouptotableA.Inthesecondgroup,theconditionshouldbeO_count=O_total_recordsand
connectthecorrespondingoutputgrouptotableB.Theoutputofdefaultgroupshouldbe
connectedtotableC.
5.Considerthefollowingproductsdatawhichcontainduplicaterows.
A
B
C
C
B
D
B

http://www.folkstalk.com/2011/06/informaticascenariobasedinterview.html

2/4

2/22/2016

InformaticaScenarioBasedInterviewQuestionswithAnswersPart1

Q1.Designamappingtoloadalluniqueproductsinonetableandtheduplicaterowsin
anothertable.
Thefirsttableshouldcontainthefollowingoutput
A
D
Thesecondtargetshouldcontainthefollowingoutput
B
B
B
C
C
Solution:
Usesortertransformationandsorttheproductsdata.Passtheoutputtoanexpression
transformationandcreateadummyportO_dummyandassign1tothatport.Sothat,the
DUMMYoutputportalwaysreturn1foreachrow.
Theoutputofexpressiontransformationwillbe
Product,O_dummy
A,1
B,1
B,1
B,1
C,1
C,1
D,1
Passtheoutputofexpressiontransformationtoanaggregatortransformation.Checkthe
groupbyonproductport.Intheaggreagtor,createanoutputportO_count_of_each_product
andwriteanexpressioncount(product).
Theoutputofaggregatorwillbe
Product,O_count_of_each_product
A,1
B,3
C,2
D,1
Nowpasstheoutputofexpressiontransformation,aggregatortransformationtojoiner
transformationandjoinontheproductsport.Inthejoinertransformationchecktheproperty
sortedinput,thenonlyyoucanconnectbothexpressionandaggregatortojoiner
transformation.
Theoutputofjoinerwillbe
product,O_dummy,O_count_of_each_product
A,1,1
B,1,3
B,1,3
B,1,3
C,1,2
C,1,2
D,1,1
Nowpasstheoutputofjoinertoaroutertransformation,createonegroupandspecifythe
groupconditionasO_dummy=O_count_of_each_product.Thenconnectthisgrouptoone
table.Connecttheoutputofdefaultgrouptoanothertable.
Q2.Designamappingtoloadeachproductonceintoonetableandtheremainingproducts
whichareduplicatedintoanothertable.
Thefirsttableshouldcontainthefollowingoutput
A

http://www.folkstalk.com/2011/06/informaticascenariobasedinterview.html

3/4

2/22/2016

InformaticaScenarioBasedInterviewQuestionswithAnswersPart1

B
C
D
Thesecondtableshouldcontainthefollowingoutput
B
B
C
Solution:
Usesortertransformationandsorttheproductsdata.Passtheoutputtoanexpression
transformationandcreateavariableport,V_curr_product,andassignproductporttoit.Then
createaV_countportandintheexpressioneditorwriteIIF(V_curr_product=V_prev_product,
V_count+1,1).CreateonemorevariableportV_prev_portandassignproductporttoit.Now
createanoutputportO_countportandassignV_countporttoit.
Intheexpressiontransformation,theportsare
Product
V_curr_product=product
V_count=IIF(V_curr_product=V_prev_product,V_count+1,1)
V_prev_product=product
O_count=V_count
Theoutputofexpressiontransformationwillbe
Product,O_count
A,1
B,1
B,2
B,3
C,1
C,2
D,1
NowPasstheoutputofexpressiontransformationtoaroutertransformation,createone
groupandspecifytheconditionasO_count=1.Thenconnectthisgrouptoonetable.Connect
theoutputofdefaultgrouptoanothertable.

Formorescenariobasedquestionsvisit
Part1
Part2
Part3
Part4
Part5
Ifyouliketheseinformaticascenarios,pleaseshareitbyclickingon+1Button.

NewerPost

Home

pnrstatus

http://www.folkstalk.com/2011/06/informaticascenariobasedinterview.html

OlderPost

privacypolicy

4/4

2/22/2016

Home

InformaticaScenarioBasedQuestionsPart2

DataWarehouse

Informatica

InformaticaScenarios

Oracle

Unix

Hadoop

InformaticaScenarioBasedQuestionsPart2
1.Considerthefollowingemployeesdataassource

Search...

Search

PopularPosts
SedCommandinUnixandLinuxExamples

employee_id,salary
10,1000
20,2000
30,3000
40,5000

TopExamplesofAwkCommandinUnix
FindCommandinUnixandLinuxExamples
CutCommandinUnix(Linux)Examples
InformaticaScenarioBasedInterviewQuestionswith
AnswersPart1

Q1.Designamappingtoloadthecumulativesumofsalariesofemployeesintotargettable?
Thetargettabledatashouldlooklikeas
employee_id,salary,cumulative_sum
10,1000,1000
20,2000,3000

DateFunctionsinHive
SQLQueriesInterviewQuestionsOraclePart1
GrepCommandinUnixandLinuxExamples

30,3000,6000

StringFunctionsinHive

40,5000,11000

TypesofDimensionsindatawarehouse

Solution:

HaveQuestions?FollowMe
ConnectthesourceQualifiertoexpressiontransformation.Intheexpressiontransformation,
createavariableportV_cum_salandintheexpressioneditorwriteV_cum_sal+salary.
CreateanoutputportO_cum_salandassignV_cum_saltoit.

vijaybhaskar
Addtocircles

Q2.Designamappingtogettheperviousrowsalaryforthecurrentrow.Ifthereisno
perviousrowexistsforthecurrentrow,thentheperviousrowsalaryshouldbedisplayedas
null.
Theoutputshouldlooklikeas
employee_id,salary,pre_row_salary
10,1000,Null
20,2000,1000
30,3000,2000
40,5000,3000
593havemeincircles

Viewall

Solution:
ConnectthesourceQualifiertoexpressiontransformation.Intheexpressiontransformation,
createavariableportV_countandincrementitbyoneforeachrowenteringtheexpression
transformation.AlsocreateV_salaryvariableportandassigntheexpression
IIF(V_count=1,NULL,V_prev_salary)toit.ThencreateonemorevariableportV_prev_salary
andassignSalarytoit.NowcreateoutputportO_prev_salaryandassignV_salarytoit.
Connecttheexpressiontransformationtothetargetports.
Intheexpressiontransformation,theportswillbe
employee_id
salary
V_count=V_count+1
V_salary=IIF(V_count=1,NULL,V_prev_salary)
V_prev_salary=salary
O_prev_salary=V_salary

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions.html

1/4

2/22/2016

InformaticaScenarioBasedQuestionsPart2

Q3.Designamappingtogetthenextrowsalaryforthecurrentrow.Ifthereisnonextrowfor
thecurrentrow,thenthenextrowsalaryshouldbedisplayedasnull.
Theoutputshouldlooklikeas
employee_id,salary,next_row_salary
10,1000,2000
20,2000,3000
30,3000,5000
40,5000,Null
Solution:
Step1:Connectthesourcequalifiertotwoexpressiontransformation.Ineachexpression
transformation,createavariableportV_countandintheexpressioneditorwriteV_count+1.
NowcreateanoutputportO_countineachexpressiontransformation.Inthefirstexpression
transformation,assignV_counttoO_count.Inthesecondexpressiontransformationassign
V_count1toO_count.
Inthefirstexpressiontransformation,theportswillbe
employee_id
salary
V_count=V_count+1
O_count=V_count
Inthesecondexpressiontransformation,theportswillbe
employee_id
salary
V_count=V_count+1
O_count=V_count1
Step2:Connectboththeexpressiontransformationstojoinertransformationandjointhemon
theportO_count.ConsiderthefirstexpressiontransformationasMasterandsecondoneas
detail.InthejoinerspecifythejointypeasDetailOuterJoin.Inthejoinertransformation
checkthepropertysortedinput,thenonlyyoucanconnectbothexpressiontransformations
tojoinertransformation.
Step3:Passtheoutputofjoinertransformationtoatargettable.Fromthejoiner,connectthe
employee_id,salarywhichareobtainedfromthefirstexpressiontransformationtothe
employee_id,salaryportsintargettable.Thenfromthejoiner,connectthesalarywhichis
obtainedfromthesecondexpressiontransformaitontothenext_row_salaryportinthetarget
table.

Q4.Designamappingtofindthesumofsalariesofallemployeesandthissumshouldrepeat
foralltherows.
Theoutputshouldlooklikeas
employee_id,salary,salary_sum
10,1000,11000
20,2000,11000
30,3000,11000
40,5000,11000
Solution:
Step1:Connectthesourcequalifiertotheexpressiontransformation.Intheexpression
transformation,createadummyportandassignvalue1toit.
Intheexpressiontransformation,theportswillbe

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions.html

2/4

2/22/2016

InformaticaScenarioBasedQuestionsPart2

employee_id
salary
O_dummy=1
Step2:Passtheoutputofexpressiontransformationtoaggregator.Createanewport
O_sum_salaryandintheexpressioneditorwriteSUM(salary).Donotspecifygroupbyon
anyport.
Intheaggregatortransformation,theportswillbe
salary
O_dummy
O_sum_salary=SUM(salary)
Step3:Passtheoutputofexpressiontransformation,aggregatortransformationtojoiner
transformationandjoinontheDUMMYport.Inthejoinertransformationchecktheproperty
sortedinput,thenonlyyoucanconnectbothexpressionandaggregatortojoiner
transformation.
Step4:Passtheoutputofjoinertothetargettable.

2.Considerthefollowingemployeestableassource
department_no,employee_name
20,R
10,A
10,D
20,P
10,B
10,C
20,Q
20,S

Q1.Designamappingtoloadatargettablewiththefollowingvaluesfromtheabovesource?
department_no,employee_list
10,A
10,A,B
10,A,B,C
10,A,B,C,D
20,A,B,C,D,P
20,A,B,C,D,P,Q
20,A,B,C,D,P,Q,R
20,A,B,C,D,P,Q,R,S
Solution:
Step1:Useasortertransformationandsortthedatausingthesortkeyasdepartment_no
andthenpasstheoutputtotheexpressiontransformation.Intheexpressiontransformation,
theportswillbe
department_no
employee_name
V_employee_list=
IIF(ISNULL(V_employee_list),employee_name,V_employee_list||','||employee_name)
O_employee_list=V_employee_list
Step2:Nowconnecttheexpressiontransformationtoatargettable.

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions.html

3/4

2/22/2016

InformaticaScenarioBasedQuestionsPart2

Q2.Designamappingtoloadatargettablewiththefollowingvaluesfromtheabovesource?
department_no,employee_list
10,A
10,A,B
10,A,B,C
10,A,B,C,D
20,P
20,P,Q
20,P,Q,R
20,P,Q,R,S
Solution:
Step1:Useasortertransformationandsortthedatausingthesortkeyasdepartment_no
andthenpasstheoutputtotheexpressiontransformation.Intheexpressiontransformation,
theportswillbe
department_no
employee_name
V_curr_deptno=department_no
V_employee_list=IIF(V_curr_deptno!=
V_prev_deptno,employee_name,V_employee_list||','||employee_name)
V_prev_deptno=department_no
O_employee_list=V_employee_list
Step2:Nowconnecttheexpressiontransformationtoatargettable.

Q3.Designamappingtoloadatargettablewiththefollowingvaluesfromtheabovesource?
department_no,employee_names
10,A,B,C,D
20,P,Q,R,S
Solution:
Thefirststepissameastheaboveproblem.Passtheoutputofexpressiontoanaggregator
transformationandspecifythegroupbyasdepartment_no.Nowconnecttheaggregator
transformationtoatargettable.
Formorescenariobasedquestionsvisit
Part1
Part2
Part3
Part4
Part5
Ifyoulikethispost,pleaseshareitbyclickingon+1Button.

NewerPost

Home

pnrstatus

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions.html

OlderPost

privacypolicy

4/4

2/22/2016

Home

InformaticaScenarioBasedQuestionsPart3

DataWarehouse

Informatica

InformaticaScenarios

Oracle

Unix

Hadoop

InformaticaScenarioBasedQuestionsPart3
1.Considerthefollowingproducttypesdataasthesource.

Search...

Search

PopularPosts
SedCommandinUnixandLinuxExamples

Product_id,product_type
10,video
10,Audio
20,Audio
30,Audio
40,Audio

TopExamplesofAwkCommandinUnix
FindCommandinUnixandLinuxExamples
CutCommandinUnix(Linux)Examples
InformaticaScenarioBasedInterviewQuestionswith
AnswersPart1

50,Audio
10,Movie
20,Movie
30,Movie
40,Movie
50,Movie
60,Movie

DateFunctionsinHive
SQLQueriesInterviewQuestionsOraclePart1
GrepCommandinUnixandLinuxExamples
StringFunctionsinHive
TypesofDimensionsindatawarehouse

Assumethatthereareonly3producttypesareavailableinthesource.Thesourcecontains
12recordsandyoudontknowhowmanyproductsareavailableineachproducttype.

HaveQuestions?FollowMe
vijaybhaskar
Q1.Designamappingtoselect9productsinsuchawaythat3productsshouldbeselected
fromvideo,3productsshouldbeselectedfromAudioandtheremaining3productsshould

Addtocircles

beselectedfromMovie.
Solution:
Step1:Usesortertransformationandsortthedatausingthekeyasproduct_type.
Step2:Connectthesortertransformationtoanexpressiontransformation.Intheexpression
transformation,theportswillbe
product_id
product_type
V_curr_prod_type=product_type
V_count=IIF(V_curr_prod_type=V_prev_prod_type,V_count+1,1)

593havemeincircles

Viewall

V_prev_prod_type=product_type
O_count=V_count
Step3:Nowconnecttheexpressiontransformaiontoafiltertransformationandspecifythe
filterconditionasO_count<=3.Passtheoutputoffiltertoatargettable.

Q2.IntheaboveproblemQ1,ifthenumberofproductsinaparticularproducttypeareless
than3,thenyouwontgetthetotal9recordsinthetargettable.Forexample,seethevideos
typeinthesourcedata.Nowdesignamappinginsuchwaythatevenifthenumberof
productsinaparticularproducttypearelessthan3,thenyouhavetogetthoselessnumber
ofrecordsfromanotherporductypes.Forexample:Ifthenumberofproductsinvideosare1,
thenthereamaining2recordsshouldcomefromaudiosormovies.So,thetotalnumberof
recordsinthetargettableshouldalwaysbe9.
Solution:

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions_17.html

1/3

2/22/2016

InformaticaScenarioBasedQuestionsPart3

Thefirsttwostepsaresameasabove.
Step3:Connecttheexpressiontransformationtoasortertransformationandsortthedata
usingthekeyasO_count.Theportsinsotertransformationwillbe
product_id
product_type
O_count(sortkey)
Step3:DiscardO_countportandconnectthesortertransformationtoanexpression
transformation.Theportsinexpressiontransformationwillbe
product_id
product_type
V_count=V_count+1
O_prod_count=V_count
Step4:Connecttheexpressiontoafiltertransformationandspecifythefilterconditionas
O_prod_count<=9.Connectthefiltertransformationtoatargettable.

2.Designamappingtoconvertcolumndataintorowdatawithoutusingthenormalizer
transformation.
Thesourcedatalookslike
col1,col2,col3
a,b,c
d,e,f
Thetargettabledatashouldlooklike
Col
a
b
c
d
e
f
Solution:
Createthreeexpressiontransformationswithoneporteach.Connectcol1fromSource
Qualifiertoportinfirstexpressiontransformation.Connectcol2fromSourceQualifiertoport
insecondexpressiontransformation.Connectcol3fromsourcequalifiertoportinthird
expressiontransformation.Createauniontransformationwiththreeinputgroupsandeach
inputgroupshouldhaveoneport.Nowconnecttheexpressiontransformationstotheinput
groupsandconnecttheuniontransformationtothetargettable.

3.Designamappingtoconvertrowdataintocolumndata.
Thesourcedatalookslike
id,value
10,a
10,b
10,c
20,d
20,e
20,f
Thetargettabledatashouldlooklike
id,col1,col2,col3

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions_17.html

2/3

2/22/2016

InformaticaScenarioBasedQuestionsPart3

10,a,b,c
20,d,e,f
Solution:
Step1:Usesortertransformationandsortthedatausingidportasthekey.Thenconnectthe
sortertransformationtotheexpressiontransformation.
Step2:Intheexpressiontransformation,createtheportsandassigntheexpressionsas
mentionedbelow.
id
value
V_curr_id=id
V_count=IIF(v_curr_id=V_prev_id,V_count+1,1)
V_prev_id=id
O_col1=IIF(V_count=1,value,NULL)
O_col2=IIF(V_count=2,value,NULL)
O_col3=IIF(V_count=3,value,NULL)
Step3:Connecttheexpressiontransformationtoaggregatortransformation.Inthe
aggregatortransforamtion,createtheportsandassigntheexpressionsasmentionedbelow.
id(specifygroupbyonthisport)
O_col1
O_col2
O_col3
col1=MAX(O_col1)
col2=MAX(O_col2)
col3=MAX(O_col3)
Stpe4:Nowconnecttheportsid,col1,col2,col3fromaggregatortransformationtothetarget
table.
Formorescenariobasedquestionsvisit
Part1
Part2
Part3
Part4
Part5
Ifyoulikethispost,pleaseshareitbyclickingon+1Button.

NewerPost

Home

pnrstatus

http://www.folkstalk.com/2011/06/informaticascenariobasedquestions_17.html

OlderPost

privacypolicy

3/3

2/22/2016

Home

InformaticaScenarioBasedQuestionsPart4

DataWarehouse

Informatica

InformaticaScenarios

Oracle

Unix

Hadoop

InformaticaScenarioBasedQuestionsPart4
Takealookatthefollowingtreestructurediagram.Fromthetreestructure,youcaneasily
derivetheparentchildrelationshipbetweentheelements.Forexample,BisparentofDand

Search...

Search

PopularPosts
SedCommandinUnixandLinuxExamples

E.
TopExamplesofAwkCommandinUnix
FindCommandinUnixandLinuxExamples
CutCommandinUnix(Linux)Examples
InformaticaScenarioBasedInterviewQuestionswith
AnswersPart1
DateFunctionsinHive
GrepCommandinUnixandLinuxExamples
StringFunctionsinHive
SQLQueriesInterviewQuestionsOraclePart1

Theabovetreestructuredataisrepresentedinatableasshownbelow.
c1,c2,c3,c4
A,B,D,H
A,B,D,I
A,B,E,NULL

TypesofDimensionsindatawarehouse

HaveQuestions?FollowMe
vijaybhaskar
Addtocircles

A,C,F,NULL
A,C,G,NULL
Hereinthistable,columnC1isparentofcolumnC2,columnC2isparentofcolumnC3,
columnC3isparentofcolumnC4.
Q1.Designamappingtoloadthetargettablewiththebelowdata.Hereyouneedto
generatesequencenumbersforeachelementandthenyouhavetogettheparentid.Asthe
element"A"isatroot,itdoesnothaveanyparentanditsparent_idisNULL.
id,element,parent_id
1,A,NULL
2,B,1
3,C,1

593havemeincircles

Viewall

4,D,2
5,E,2
6,F,3
7,G,3
8,H,4
9,I,4
IhaveprovidedthesolutionforthisprobleminOracleSqlquery.Ifyouareinterestedyoucan
ClickHeretoseethesolution.
Q2.ThisisanextensiontotheproblemQ1.LetsaycolumnC2hasnullforalltherows,then
C1becomestheparentofC3andc3isparentofC4.Letsaybothcolumnsc2andc3hasnull
foralltherows.Thenc1becomestheparentofc4.Designamappingtoaccommodatethese
typeofnullconditions.
Formorescenariobasedquestionsvisit
Part1

http://www.folkstalk.com/2011/07/informaticascenariobasedquestions.html

1/2

2/22/2016

InformaticaScenarioBasedQuestionsPart4

Part2
Part3
Part4
Part5

NewerPost

Home

pnrstatus

http://www.folkstalk.com/2011/07/informaticascenariobasedquestions.html

OlderPost

privacypolicy

2/2

2/22/2016

InformaticaScenarioBasedQuestionsPart5

Home

DataWarehouse

Informatica

InformaticaScenarios

Oracle

Unix

Hadoop

InformaticaScenarioBasedQuestionsPart5
Q1.Thesourcedatacontainsonlycolumn'id'.Itwillhavesequencenumbersfrom1to1000.
Thesourcedatalookslikeas
Id
1

Search...

Search

PopularPosts
SedCommandinUnixandLinuxExamples
TopExamplesofAwkCommandinUnix

FindCommandinUnixandLinuxExamples

CutCommandinUnix(Linux)Examples

4
5
6
7

InformaticaScenarioBasedInterviewQuestionswith
AnswersPart1
DateFunctionsinHive

8
....
1000

CreateaworkflowtoloadonlytheFibonaccinumbersinthetargettable.Thetargettable
datashouldlooklikeas

GrepCommandinUnixandLinuxExamples
SQLQueriesInterviewQuestionsOraclePart1
StringFunctionsinHive
TypesofDimensionsindatawarehouse

Id
1
2
3
5

HaveQuestions?FollowMe
vijaybhaskar
Addtocircles

8
13
.....

InFibonacciserieseachsubsequentnumberisthesumofprevioustwonumbers.Here
assumethatthefirsttwonumbersofthefibonacciseriesare1and2.
Solution:
STEP1:DragthesourcetothemappingdesignerandthenintheSourceQualifier
Transformationproperties,setthenumberofsortedportstoone.Thiswillsortthesource
datainascendingorder.Sothatwewillgetthenumbersinsequenceas1,2,3,....1000

593havemeincircles

Viewall

STEP2:ConnecttheSourceQualifierTransformationtotheExpressionTransformation.Inthe
ExpressionTransformation,createthreevariableportsandoneoutputport.Assignthe
expressionstotheportsasshownbelow.
PortsinExpressionTransformation:
id
v_sum=v_prev_val1+v_prev_val2
v_prev_val1=IIF(id=1orid=2,1,IIF(v_sum=id,v_prev_val2,v_prev_val1))
v_prev_val2=IIF(id=1orid=2,2,IIF(v_sum=id,v_sum,v_prev_val2))
o_flag=IIF(id=1orid=2,1,IIF(v_sum=id,1,0))
STEP3:NowconnecttheExpressionTransformationtotheFilterTransformationandspecify
theFilterConditionaso_flag=1
STEP4:ConnecttheFilterTransformationtotheTargetTable.

http://www.folkstalk.com/2011/11/informaticascenariobasedquestions.html

1/3

2/22/2016

InformaticaScenarioBasedQuestionsPart5

Q2.Thesourcetablecontainstwocolumns"id"and"val".Thesourcedatalookslikeasbelow
idval
1a,b,c
2pq,m,n
3asz,ro,liqt

Herethe"val"columncontainscommadelimiteddataandhasthreefieldsinthatcolumn.
Createaworkflowtosplitthefieldsinvalcolumntoseparaterows.Theoutputshouldlook
likeasbelow.
idval
1a
1b
1c
2pq
2m
2n
3asz
3ro
3liqt

Solution:
STEP1:ConnectthreeSourceQualifiertransformationstotheSourceDefinition
STEP2:NowconnectallthethreeSourceQualifiertransformationstotheUnion
Transformation.ThenconnecttheUnionTransformationtotheSorterTransformation.Inthe
sortertransformationsortthedatabasedonIdportinascendingorder.
STEP3:PasstheoutputofSorterTransformationtotheExpressionTransformation.Theports
inExpressionTransformationare:
id(input/outputport)
val(inputport)
v_currend_id(variableport)=id
v_count(variableport)=IIF(v_current_id!=v_previous_id,1,v_count+1)
v_previous_id(variableport)=id
o_val(outputport)=DECODE(v_count,1,
SUBSTR(val,1,INSTR(val,',',1,1)1),
2,
SUBSTR(val,INSTR(val,',',1,1)+1,INSTR(val,',',1,2)INSTR(val,',',1,1)1),
3,
SUBSTR(val,INSTR(val,',',1,2)+1),
NULL
)
STEP4:NowpasstheoutputofExpressionTransformationtotheTargetdefinition.Connect
id,o_valportsofExpressionTransformationtotheid,valportsofTargetDefinition.
Forthosewhoareinterestedtosolvethisprobleminoraclesql,ClickHere.Theoraclesql
queryprovidesadynamicsolutionwherethe"val"columncanhavevaryingnumberoffields
ineachrow.
Formorescenariobasedquestionsvisit
Part1
Part2
Part3
Part4
Part5

http://www.folkstalk.com/2011/11/informaticascenariobasedquestions.html

2/3

2/22/2016

InformaticaScenarioBasedQuestionsPart5

Ifyoulikethispost,pleaseshareitbyclickingon+1Button.

NewerPost

Home

pnrstatus

http://www.folkstalk.com/2011/11/informaticascenariobasedquestions.html

OlderPost

privacypolicy

3/3

You might also like