cancel
Showing results for 
Search instead for 
Did you mean: 

Performance of an UDF v/s standard graphical mapping functions

Former Member
0 Kudos

Hello Experts,

I would like to get your opinion/comments on the performance issues with respect to speed of execution when using graphical functions for doing the date conversion requirement given below:

Requirement is to convert input date u20182008-12-03u2019 from the source side to u201820081203u2019 on the target side.

We have used the standard graphical mapping functions 'substring' & 'replacestring' for doing this conversion as explained here: The u2018substringu2018 function is used to capture the part of the string from the source. A u2018constantu2019 with value u2018u2013u2018 is replaced by u2018constantu2019 (empty value) by using the standard text function u2018replaceStringu2019 in the target side.

We did the same using the following UDF too:

public String convertDate(String dateStringInOriginalFormat) {

SimpleDateFormat originalFormatter = new SimpleDateFormat("yyyy-MM-dd");

SimpleDateFormat newFormatter = new SimpleDateFormat("yyyyMMdd");

ParsePosition pos = new ParsePosition(0);

Date dateFromString = originalFormatter.parse(

dateStringInOriginalFormat, pos);

String dateStringInNewFormat = newFormatter.format(dateFromString);

return dateStringInNewFormat;

}

From a critical performance point of view, which approach will fare better?

Thanks in Advance,

Earnest A Thomas

Edited by: Earnest Thomas on Dec 4, 2008 6:54 AM

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Both UDF and standard functions gets executed in java stack. For the case you mentioned, there would be hardly any difference in performance. If you execute a huge such case, then the UDF may perform a bit better that the standard functions but that too only fraction of seconds.

Regards,

Prateek

Former Member
0 Kudos

Prateek,

Thanks for the reply.

Regards,

Earnest

Edited by: Earnest Thomas on Dec 4, 2008 7:16 AM

Answers (1)

Answers (1)

former_member200962
Active Contributor
0 Kudos

Hi,

Not only in this case but in general it is always better to use the functions available in MM and only if your requirement is not satisfied with the standard mapping functions then go for UDF.

Also for your requirement no need of going for substring....you can directly use the DateTransform function available.

Source --> DateTransform --> Target

Regards,

Abhishek.

Edited by: abhishek salvi on Dec 4, 2008 11:25 AM