on 12-04-2008 5:52 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.