[resolved] Problem in tUniqRow and tMap

One Star

[resolved] Problem in tUniqRow and tMap

hai,
I have two jobs.
first job :
tfileInputdel --- > tsort----- > tuniqueRow---uniques--->tMap----> mysql
second job :
tfileInputdelemited---->tMap--- > tsortrow----- > tuniqueRow---uniques--->tfileOutputDel
first job working fine. im able to insert unique values to mysql table.
but in second job im facing problem. In second job, tsortRow working fine but tUniqueRoe is not giving uniques values.
so this is resulting in duplicate values in file.
Can anybody explain why this abnormal behavior is happening??

Thanks and Regards,
Akshath Hegde

Accepted Solutions
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Thank you BhanuChandar for your answer.
I got the solution for that. my solution as follows.
job design :
tFileInputdel--date format--> tMap ---string format----> tsortRow ---string format--- >tUnique ----string format-- > tLogRow
Field : START_TIME_STAMP (format : "yyyy-MM-dd HH:mm:ss")
my solution is simple: im converting date to string in tMap. just give FormatterUtils.format(row1.START_TIME_STAMP,"yyyy-MM-dd") in expression builder of tMap.

Thanks and Regards,
Akshath Hegde

All Replies
Moderator

Re: [resolved] Problem in tUniqRow and tMap

Hi,
but in second job im facing problem. In second job, tsortRow working fine but tUniqueRoe is not giving uniques values.

You can use tLogrow to print output data from tSortRow on console to see if there is any duplicated row in job 2. How did you set tMap component in job 2? Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Thank you for quick reply.
For your information, We are using outputfile of second job as input file for 1st job.
here goes the explanation:
job2 have files with one field. So that field is START_DATE.
example:
START_DATE:
2014-03-04
2014-03-04
2014-03-04
2014-03-05
2014-03-04
2014-03-04
2014-03-04
2014-03-05
2014-03-05
2014-03-05
as you told i used Logrow but its taking all rows and inserting into output file.
but wen i run 1st job its sorting rows properly. whether usage of tMap before tsortRow is making any difference??
so same components giving two different results. its quite confusing. can u please help me to solve it.
Thanks and Regards,
Akshath Hegde
Moderator

Re: [resolved] Problem in tUniqRow and tMap

Hi,
Did you set any expression or filter in tMap of second job? Could you show us this tMap editor screenshot so that we can take a testing to see if it is abnormal.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Here is input file data:
START_TIME
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 10:20:02
2014-03-04 10:25:02
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 10:20:02
2014-03-04 10:25:02
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 10:20:02
2014-03-04 10:25:02
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 02:00:00
2014-03-04 11:00:00

job structure :
tfileinputde--- > tMap---> tsort--> tuniqueRow---unqiues-- >tlogrow
data type in tFileInputDel : Date (format: yyyy-MM-dd HH:mm:ss)
Expected Output:
2014-03-05
2014-03-04
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Anybody please suggest any solution for above problem.
Thanks and Regards,
Akshath Hegde
Moderator

Re: [resolved] Problem in tUniqRow and tMap

Hi,
I have make a testing for you use case and found job 1 and job 2 have same result. Feel free let me know if I missing.
The actual result should be :
2014-03-04 (10:20:02)
2014-03-04 (10:25:02)
2014-03-04 (11:00:00)
2014-03-05 (11:20:05)
2014-03-05 (10:20:02)
2014-03-05 (02:00:00)(the HH:mm:ss are not displayed according to the date pattern setting yyyy-MM-dd)
Please see my screenshots
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Thank you reply. but result should be as follows:
Result :
2014-03-04
2014-03-05
but in your screen shot same date is displayed multiple time. job should display only unique dates.
In resultant LogRow same date displayed more then once. Hope u got my point.
Thanks and Regards,
Akshath Hegde
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Anybody know how can we resolve this problem?? please let me know how to resolve this one.
Thanks and Regards,
Akshath Hegde
One Star

Re: [resolved] Problem in tUniqRow and tMap

What do you get as your sorted output - you haven't said.
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Thank you for response. Will you please look into snap shots which sabrina posted. in that sorted and everything you will get to know. and input also i have mentioned in my previous post.
don wanted to tell this but Have to tell now, talend people least bothered of our posts!!! some component is not working as per our requirement, example tsortRow And tUniqueRow.
i want unique dates from these input (ignore the time in tMap):
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 10:20:02
2014-03-04 10:25:02
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 10:20:02
2014-03-04 10:25:02
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 10:20:02
2014-03-04 10:25:02
2014-03-04 10:20:02
2014-03-05 11:20:05
2014-03-05 02:00:00
2014-03-04 11:00:00
so output should be :
2014-03-04
2014-03-05
We have date format in tsort and tUniqueRow (i.e. we can select only yyyy-MM-dd from yyyy-MM-dd HH:mm:ss)
but its not working only.
sabrina posted answer like this :
2014-03-04
2014-03-04
2014-03-04
2014-03-05
2014-03-05
2014-03-05
for anybody this final result looks like unique!!!! both "2014-03-04" and "2014-03-05" displayed three times!!

-akshath
Two Stars

Re: [resolved] Problem in tUniqRow and tMap

Hi Akshath,
As you said that to ignore time in tmap,
I have create a job in such a way that to meet your requirement and got the output like "2014-03-04" and "2014-03-05".
tFileinputDelimited--(main)--tjavarow--(main)--tuniquerow--tlogRow.
i have taken input as string and if you want in date format you can use tconvertType after tuniqueRow.
The code i have used in tJavaRow is
output_row.START_TIME=TalendDate.formatDate("yyyy-MM-dd",
TalendDate.parseDate("yyyy-MM-dd", input_row.START_TIME));.
One Star

Re: [resolved] Problem in tUniqRow and tMap

hi,
Thank you BhanuChandar for your answer.
I got the solution for that. my solution as follows.
job design :
tFileInputdel--date format--> tMap ---string format----> tsortRow ---string format--- >tUnique ----string format-- > tLogRow
Field : START_TIME_STAMP (format : "yyyy-MM-dd HH:mm:ss")
my solution is simple: im converting date to string in tMap. just give FormatterUtils.format(row1.START_TIME_STAMP,"yyyy-MM-dd") in expression builder of tMap.

Thanks and Regards,
Akshath Hegde