博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
INFORMATICA1
阅读量:4209 次
发布时间:2019-05-26

本文共 18635 字,大约阅读时间需要 62 分钟。

INFORMATICA INTERVIEW QUESTIONS ON ROUTER TRANSFORMATION

1.
 What is a router transformation?


A router is used to filter the rows in a mapping. Unlike filter transformation, you can specify one or more conditions in a router transformation. Router is an active transformation.


2.
 How to improve the performance of a session using router transformation?


Use router transformation in a mapping instead of creating multiple filter transformations to perform the same task. The router transformation is more efficient in this case. When you use a router transformation in a mapping, the integration service processes the incoming data only once. When you use multiple filter transformations, the integration service processes the incoming data for each transformation.


3.
 What are the different groups in router transformation?


The router transformation has the following types of groups:

  • Input
  • Output

4.
 How many types of output groups are there?


There are two types of output groups:

  • User-defined group
  • Default group
5.
 Where you specify the filter conditions in the router transformation?


You can creat the group filter conditions in the groups tab using the expression editor.


6.
 Can you connect ports of two output groups from router transformation to a single target?


No. You cannot connect more than one output group to one target or a single input group transformation.

INFORMATICA INTERVIEW QUESTIONS ON AGGREGATOR TRANSFORMATION

1.
 What is aggregator transformation?

Aggregator transformation performs aggregate calculations like sum, average, count etc. It is an active transformation, changes the number of rows in the pipeline. Unlike expression transformation (performs calculations on a row-by-row basis), an aggregator transformation performs calculations on group of rows.


2.
 What is aggregate cache?

The integration service creates index and data cache in memory to process the aggregator transformation and stores the data group in index cache, row data in data cache. If the integration service requires more space, it stores the overflow values in cache files.


3.
 How can we improve performance of aggregate transformation?

  • Use sorted input: Sort the data before passing into aggregator. The integration service uses memory to process the aggregator transformation and it does not use cache memory.
  • Filter the unwanted data before aggregating.
  • Limit the number of input/output or output ports to reduce the amount of data the aggregator transformation stores in the data cache.

4.
 What are the different types of aggregate functions?


The different types of aggregate functions are listed below:

  • AVG
  • COUNT
  • FIRST
  • LAST
  • MAX
  • MEDIAN
  • MIN
  • PERCENTILE
  • STDDEV
  • SUM
  • VARIANCE

5.
 Why cannot you use both single level and nested aggregate functions in a single aggregate transformation?


The nested aggregate function returns only one output row, whereas the single level aggregate function returns more than one row. Since the number of rows returned are not same, you cannot use both single level and nested aggregate functions in the same transformation. If you include both the single level and nested functions in the same aggregator, the designer marks the mapping or mapplet as invalid. So, you need to create separate aggregator transformations.


6.
 Up to how many levels, you can nest the aggregate functions?


We can nest up to two levels only.

Example: MAX( SUM( ITEM ) )


7.
 What is incremental aggregation?


The integration service performs aggregate calculations and then stores the data in historical cache. Next time when you run the session, the integration service reads only new data and uses the historical cache to perform new aggregation calculations incrementally.


8.
 Why cannot we use sorted input option for incremental aggregation?


In incremental aggregation, the aggregate calculations are stored in historical cache on the server. In this historical cache the data need not be in sorted order.  If you give sorted input, the records come as presorted for that particular run but in the historical cache the data may not be in the sorted order. That is why this option is not allowed.


9.
 How the NULL values are handled in Aggregator?


You can configure the integration service to treat null values in aggregator functions as NULL or zero. By default the integration service treats null values as NULL in aggregate functions.

GET PREVIOUS ROW VALUE IN INFORMATICA

How to get the previous row value while processing the current row in informatica? 


One of my blog readers asked this question. The source data is shown below: 

Table Name: Customerscust_id, Year, City-----------------------10,      2001, BLR10,      2002, MUM10,      2003, SEA10,      2004, NY20,      2001, DEL20,      2002, NCR20,      2003, HYD

The question is for each customer when processing the record for current row, you have to get the previous row city value. If there is no previous row, then make the previous row value as null. The output data is shown below: 

Table Name: Customers_TGTcust_id, Year, City, prev_city------------------------------10,      2001, BLR,  NULL10,      2002, MUM,  BLR10,      2003, SEA,  MUM10,      2004, NY,   SEA20,      2001, DEL,  NuLL,20,      2002, NCR,  DEL20,      2003, HYD,  NCR

GETTING PREVIOUS ROW VALUE INFORMATICA MAPPING LOGIC


Solution


  • Connect the source qualifier transformation to the sorter transformation and sort the data on cust_id, year ports in ascending order.
  • Connect the sorter transformation to the expression transformation. In the expression transformation, create the below additional ports and assign the corresponding expressions:

cust_id  (input/output port)year     (input/output port)city     (input/output port)v_current_cust_id  (variable port) = cust_ido_previous_city    (output port  ) = IIF(v_current_cust_id = v_previous_cust_id, v_previous_city, NULL)v_previous_city    (variable port) = cityv_previous_cust_id (variable port) = cust_id
  • Connect the output ports of expression transformation to the target.

If you face any issues, then comment here. 


Recommended Reading: 

INFORMATICA INTERVIEW QUESTIONS ON UNION TRANSFORMATION

1.
 What is a union transformation?


A union transformation is used merge data from multiple sources similar to the UNION ALL SQL statement to combine the results from two or more SQL statements.


2.
 As union transformation gives UNION ALL output, how you will get the UNION output?


Pass the output of union transformation to a sorter transformation. In the properties of sorter transformation check the option select distinct. Alternatively you can pass the output of union transformation to aggregator transformation and in the aggregator transformation specify all ports as group by ports.


3.
 What are the guidelines to be followed while using union transformation?


The following rules and guidelines need to be taken care while working with union transformation:

  • You can create multiple input groups, but only one output group.
  • All input groups and the output group must have matching ports. The precision, datatype, and scale must be identical across all groups.
  • The Union transformation does not remove duplicate rows. To remove duplicate rows, you must add another transformation such as a Router or Filter transformation.
  • You cannot use a Sequence Generator or Update Strategy transformation upstream from a Union transformation.
  • The Union transformation does not generate transactions.
4.
 Why union transformation is an active transformation?


Union is an active transformation because it combines two or more data streams into one. Though the total number of rows passing into the Union is the same as the total number of rows passing out of it, and the sequence of rows from any given input stream is preserved in the output, the positions of the rows are not preserved, i.e. row number 1 from input stream 1 might not be row number 1 in the output stream. Union does not even guarantee that the output is repeatable

INFORMATICA INTERVIEW QUESTIONS ON TRANSACTION CONTROL TRANSFORMATION

1.
 What is a transaction control transformation?


A transaction is a set of rows bound by a commit or rollback of rows. The transaction control transformation is used to commit or rollback a group of rows.


2.
 What is the commit type if you have a transaction control transformation in the mapping?


The commit type is "user-defined".


3.
 What are the different transaction levels available in transaction control transformation?

The following are the transaction levels or built-in variables:

  • TC_CONTINUE_TRANSACTION: The Integration Service does not perform any transaction change for this row. This is the default value of the expression.
  • TC_COMMIT_BEFORE: The Integration Service commits the transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.
  • TC_COMMIT_AFTER: The Integration Service writes the current row to the target, commits the transaction, and begins a new transaction. The current row is in the committed transaction.
  • TC_ROLLBACK_BEFORE: The Integration Service rolls back the current transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction.
  • TC_ROLLBACK_AFTER: The Integration Service writes the current row to the target, rolls back the transaction, and begins a new transaction. The current row is in the rolled back transaction.

INFORMATICA INTERVIEW QUESTIONS ON SORTER TRANSFORMATION

1. What is a sorter transformation?
Sorter transformation is used to sort the data. You can sort the data either in ascending or descending order according to a specified sort key.
2. Why sorter is an active transformation?
As sorter transformation can suppress the duplicate records in the source, it is called an active transformation.
3. How to improve the performance of a session using sorter transformation?
Sort the data using sorter transformation before passing in to aggregator or joiner transformation. As the data is sorted, the integration service uses the memory to do aggregate and join operations and does not use cache files to process the data.

INFORMATICA INTERVIEW QUESTIONS ON EXPRESSION TRANSFORMATION

1.
 What is an expression transformation?


An expression transformation is used to calculate values in a single row.

Example: salary+1000


2.
 How to generate sequence numbers using expression transformation?

Create a variable port in expression transformation and increment it by one for every row. Assign this variable port to an output port.


3.
 Consider the following employees data as source?


Employee_id, Salary-------------------10,          100020,          200030,          300040,          5000

Q1.
 Design a mapping to load the cumulative sum of salaries of employees into target table?

The target table data should look like as


Employee_id, Salary, Cumulative_sum-----------------------------------10,          1000,      100020,          2000,      300030,          3000,      600040,          5000,      11000

Q2.
 Design a mapping to get the pervious row salary for the current row. If there is no pervious row exists for the current row, then the pervious row salary should be displayed as null.

The output should look like as


Employee_id, Salary, Pre_row_salary-----------------------------------10,          1000,      Null20,          2000,      100030,          3000,      200040,          5000,      3000

4.
 Consider the following employees table as source


Department_no, Employee_name----------------------------20,               R10,               A10,               D20,               P10,               B10,               C20,               Q20,               S

Q1.
 Design a mapping to load a target table with the following values from the above source?


Department_no, Employee_list----------------------------10,            A10,            A,B10,            A,B,C10,            A,B,C,D20,            A,B,C,D,P20,            A,B,C,D,P,Q20,            A,B,C,D,P,Q,R20,            A,B,C,D,P,Q,R,S

Q2.
 Design a mapping to load a target table with the following values from the above source?


Department_no, Employee_list----------------------------10,            A10,            A,B10,            A,B,C10,            A,B,C,D20,            P20,            P,Q20,            P,Q,R20,            P,Q,R,S

INFORMATICA SCENARIO BASED QUESTIONS - PART 2

1. Consider the following employees data as source
employee_id, salary
10, 1000
20, 2000
30, 3000
40, 5000
Q1. Design a mapping to load the cumulative sum of salaries of employees into target table?
The target table data should look like as
employee_id, salary, cumulative_sum
10, 1000, 1000
20, 2000, 3000
30, 3000, 6000
40, 5000, 11000
Solution:
Connect the source Qualifier to expression transformation. In the expression transformation, create a variable port V_cum_sal and in the expression editor write V_cum_sal+salary. Create an output port O_cum_sal and assign V_cum_sal to it.
Q2. Design a mapping to get the pervious row salary for the current row. If there is no pervious row exists for the current row, then the pervious row salary should be displayed as null.
The output should look like as
employee_id, salary, pre_row_salary
10, 1000, Null
20, 2000, 1000
30, 3000, 2000
40, 5000, 3000
Solution:
Connect the source Qualifier to expression transformation. In the expression transformation, create a variable port V_count and increment it by one for each row entering the expression transformation. Also create V_salary variable port and assign the expression IIF(V_count=1,NULL,V_prev_salary) to it . Then create one more variable port V_prev_salary and assign Salary to it. Now create output port O_prev_salary and assign V_salary to it. Connect the expression transformation to the target ports.
In the expression transformation, the ports will be
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
Q3. Design a mapping to get the next row salary for the current row. If there is no next row for the current row, then the next row salary should be displayed as null.
The output should look like as
employee_id, salary, next_row_salary
10, 1000, 2000
20, 2000, 3000
30, 3000, 5000
40, 5000, Null
Solution: 
Step1:
 Connect the source qualifier to two expression transformation. In each expression transformation, create a variable port V_count and in the expression editor write V_count+1. Now create an output port O_count in each expression transformation. In the first expression transformation, assign V_count to O_count. In the second expression transformation assign V_count-1 to O_count.
In the first expression transformation, the ports will be
employee_id 
salary
V_count=V_count+1
O_count=V_count
In the second expression transformation, the ports will be
employee_id 
salary
V_count=V_count+1
O_count=V_count-1
Step2: Connect both the expression transformations to joiner transformation and join them on the port O_count. Consider the first expression transformation as Master and second one as detail. In the joiner specify the join type as Detail Outer Join. In the joiner transformation check the property sorted input, then only you can connect both expression transformations to joiner transformation.
Step3: Pass the output of joiner transformation to a target table. From the joiner, connect the employee_id, salary which are obtained from the first expression transformation to the employee_id, salary ports in target table. Then from the joiner, connect the salary which is obtained from the second expression transformaiton to the next_row_salary port in the target table.
Q4. Design a mapping to find the sum of salaries of all employees and this sum should repeat for all the rows.
The output should look like as
employee_id, salary, salary_sum
10, 1000, 11000
20, 2000, 11000
30, 3000, 11000
40, 5000, 11000
Solution:
Step1:
 Connect the source qualifier to the expression transformation. In the expression transformation, create a dummy port and assign value 1 to it.
In the expression transformation, the ports will be
employee_id
salary
O_dummy=1
Step2: Pass the output of expression transformation to aggregator. Create a new port O_sum_salary and in the expression editor write SUM(salary). Do not specify group by on any port.
In the aggregator transformation, the ports will be
salary
O_dummy
O_sum_salary=SUM(salary)
Step3: Pass the output of expression transformation, aggregator transformation to joiner transformation and join on the DUMMY port. In the joiner transformation check the property sorted input, then only you can connect both expression and aggregator to joiner transformation.
Step4: Pass the output of joiner to the target table.
2. Consider the following employees table as source
department_no, employee_name
20, R
10, A
10, D
20, P
10, B
10, C
20, Q
20, S
Q1. Design a mapping to load a target table with the following values from the above source?
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:
 Use a sorter transformation and sort the data using the sort key as department_no and then pass the output to the expression transformation. In the expression transformation, the ports will be
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: Now connect the expression transformation to a target table.
Q2. Design a mapping to load a target table with the following values from the above source?
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:
 Use a sorter transformation and sort the data using the sort key as department_no and then pass the output to the expression transformation. In the expression transformation, the ports will be
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: Now connect the expression transformation to a target table.
Q3. Design a mapping to load a target table with the following values from the above source?
department_no, employee_names
10, A,B,C,D
20, P,Q,R,S
Solution: 
The first step is same as the above problem. Pass the output of expression to an aggregator transformation and specify the group by as department_no. Now connect the aggregator transformation to a target table.
For more scenario based questions visit
  
If you like this post, please share it by clicking on +1 Button.

转载地址:http://hzrli.baihongyu.com/

你可能感兴趣的文章
c++编译器构造析构方案 PK 对象显示初始化方案
查看>>
拷贝构造函数调用时机第一种和第二种调用场景
查看>>
c++中copy构造函数调用的第三种情形
查看>>
c++设计模式之简单工厂模式
查看>>
c++设计模式之工厂模式
查看>>
c++设计模式之三~抽象工厂模式
查看>>
c++设计模式之单例模式
查看>>
c++设计模式之建造者模式
查看>>
c++设计模式之原型模式
查看>>
c++设计模式之适配器模式
查看>>
c++设计模式之桥接模式
查看>>
c++设计模式之一组合模式
查看>>
c++设计模式之装饰模式
查看>>
c++设计模式之一:外观模式
查看>>
c++设计模式之一:享元模式
查看>>
c++设计模式之一:代理模式
查看>>
c++设计模式之:职责链模式
查看>>
c++设计模式之命令模式
查看>>
c++设计模式之:解释器模式
查看>>
c++设计模式之迭代器模式
查看>>