Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I had one scenario in which I need to compare the data with in the file.
for example: file1 has data:
This is book.
This is car.
This is book.
In this I need to know how many lines are duplicate.
Thanks in advance..!!
Please specify expected output.
Regards,
Hi
you can do so by tAggregateRow component by follow below flow:
tfileinput*--> tAggregaterow-->tfileoutput*
In tAggregaterow:
*group by data/or whatever be a name of column
*operation count(data/or whatever be a name of column)
Hi,
The expected o/p will be:
This is book. was come 2 times in a file
Regards,
Akash Rastogi
I think the component you're after is tUniqRow
Hi David,
I think tUniqRow component is used to filtering the unique and duplicate records.
But in my scenario I want the exact count how many times that particular sentence had come.
-Akash
Hi Aashish,
Can you please more elaborate. I am unable to understand the solution.
My data is in file how can I use tAggregateRow on that.
-Akash
@rastogi_akashfor reading a file use tfileinputdelimited and let say your file having schema like sentence string type then use tmap and generate output with same sentence column two times,
So now we have two output column first sentence and second column (named as cnt) then add tggregaterow edit schema accordingly change datatype of cnt from string to integer and add sentence to group by and cnt to operation with function type count
your output will be :
sentence;cnt
a;1
b;2
c;1
you can use this result as per your requirement.