byte[] fred = {-122, -97, -120, 111};
System.out.println(fred.toString());
System.out.println(new String(fred));
Well, you would same they should print the same right. Sadly wrong. So this took me a day of debugging to find out why my Fact table was producing the wrong results from the Data Warehouse queries. So I tried
- Stuffing the data into a BLOB, well its binary after all. Broke all the joins over this column
- Converting to Hex but got different results for the same byte[] value
- Converting to a Binary String (i.e. 1's and 0's), but seemed horribly inefficient
- Converting to a String, like Hex got different results for the same byte[] value and was unprintable through the mysql prompt
No comments:
Post a Comment