on 04-05-2011 12:52 PM
Hi All,
Source File
___________
Eno ename
____________
10 AA
20 BB
10 AA
30 CC
My requirement is need to identify the duplicate records at the mapping level.
Condition as below.
If eno and ename > 2 then status = "X"
else
Status = " "
Please provide me the JAVA UDF code for this.
Thanks,
Sagar.
Try a simple approach without using any UDF.
First Concatenate Eno & Ename by using Concat function and then follow below logic.
Eno+Ename>RemoveContext>Sort>SplitByValue(on value change)>Count-->IF (count > 2) map 'X' else map empty constant ' '.
You may have to do some tweaks but this logic will solve your problem easily.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another option would be
Eno+Ename>RemoveContext>Sort>SplitByValue(on value change)>CollapseContexts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try something like this:
public void TEST(HashMap<int,String> INPUTTABLE,ResultList result,Container container){
HashMap<String,int> frequencymap = new HashMap<String,int>();
foreach(String a in INPUTTABLE) {
if(frequencymap.containsKey(a)) {
frequencymap.put(a, frequencymap.get(a)+1);
result.addValue("1");
break;
}
else{ frequencymap.put(a, 1); }
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.