Review Board 1.7.22


BigDecimals converted to String in inconsistent format

Review Request #9081 - Created Jan. 24, 2013 and submitted

David Robson
SQOOP-830
Reviewers
Sqoop
sqoop-trunk
Currently when BigDecimal fields are saved as Strings Sqoop uses the ToString method. This leads to values like "0.0000001" being stored as "1E-7" which doesn't seem ideal.
This patch changes Sqoop to use ToPlainString for BigDecimals so they will always be stored in the same format. This should have minimal effect as they can still be converted back to BigDecimals no matter which way they are stored - and the scale doesn't seem relevant - it seems to always be zero anyway so there shouldn't be any change there.
I added a new parameter "sqoop.bigdecimal.format.string" which can be set to false to revert to the old behaviour.
I didn't add this as a command line parameter as it seems like something most users would not change so didn't want to confuse the user with another option - they can override it in sqoop-site.xml or on the command line using -D.
Have manually tested text file, avro file and hbase imports using both values of the new parameter.
Also checked that if the parameter is not set it will use the toPlainString.
I tested sequence files but there is no change as they don't use the toString methods.
Total:
1
Open:
1
Resolved:
0
Dropped:
0
Status:
From:
Review request changed
Updated (Feb. 5, 2013, 3:53 a.m.)
  • changed from pending to submitted