need help in designing a comparator with mapping rules
Posted on 2011-05-03
I am trying to implement a comparator in JAVA. The objective of the comparator is to compare 3 CSV files. the CSV files will contain the table dump from sybase 12 , sybase 15 and oracle dbs. The is supposed to be identical except a few exceptions caused by the variation in available datatypes in these databases. The comparision will be something like
1) take the first row from all the 3 csv files
2) compare each field of this row with the coprable field of the other two csv files
3)PASS if identical or complies with the mapping rule mentioned below
a)date in format mmddyyy is same as date in mon, day, year
b) ignore numbers beyond 4th decimal points (1.11125 is equal to 1.11126)
c) sybase char field containing trailing spaces will be trimmed in oracle. Hence oracle won't have trailing spaces in varchar field even if the corresponding field in sybase has trailing space.
and some more rules.
I want to know the optimal design for such a comparator. Please give me the high level design and if i need further detail i will ask as we go along.
and a few other rules