Reintegrated asterix_fix_issue_224. Code reviewed by Sattam. Tests added by Khurram.

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@1123 eaa15691-b419-025a-1212-ee371bd00084