Ticket #8184 (closed: fixed)
String table workspaces don't match when saved & loaded
Reported by: | Samuel Jackson | Owned by: | Russell Taylor |
---|---|---|---|
Priority: | major | Milestone: | Release 3.1 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Samuel Jackson |
Description
I tried saving out a table workspace full of string data, then doing a CheckWorkspacesMatch for a system test.
It turns out that string data gets padded to align in in the centre of the column when saved (in NexusFileIO). This makes it look nice, but causes CheckWorkspacesMatch to fail as the two strings no longer match!
Change History
comment:1 Changed 7 years ago by Russell Taylor
- Owner changed from Anyone to Russell Taylor
- Milestone changed from Backlog to Release 3.1
comment:2 Changed 7 years ago by Russell Taylor
- Status changed from new to inprogress
The white space isn't for formatting, it's so that the entire column is saved in one long block of characters where an equal number of characters (the longest string in the column) correspond to each cell.
I'm not at all sure saving the data in this manner is necessary, or that it's the best way to do it, but I don't think I can change it without potentially breaking previously saved files. So I'll just fix things at the loading end.
comment:3 Changed 7 years ago by Russell Taylor
Re #8184. Fix error in generating log message.
Changeset: 81439d02e055e9a8e6a84c8c9f51b6d606dd5829
comment:4 Changed 7 years ago by Russell Taylor
Re #8184. Add a test for loading a TableWorkspace.
Fails right now because of the extra whitespace at the end of entries in the string column.
Changeset: 7d679dbcc31baffc93a53c696e0413f1365c9c29
comment:5 Changed 7 years ago by Russell Taylor
Re #8184. Remove whitespace at the end of loaded strings.
The entries in columns of string type are, for better or worse, saved in fixed-length strings which are padded with whitespace. This removes that whitespace on loading so that the table is unchanged compared to the original.
Changeset: 06d8c83698458d910b9dcb838c753a25f8cae610
comment:6 Changed 7 years ago by Russell Taylor
Re #8184. Remove code that can't be reached.
Just clearing coverity warnings while I'm touching the file.
Changeset: 1f3571374c8fbbc60814d0a83ff05adaf2c169d3
comment:7 Changed 7 years ago by Russell Taylor
Re #8184. Clear coverity warning while I'm touching the file.
The warning was that a dynamic_cast was used, but the outcome not being checked. This is because we know it to be a TextAxis at this point - therefore, just use a static_cast.
Changeset: 8ff0433f38771e96c1844b9f3f0612966d1daef4
comment:8 Changed 7 years ago by Russell Taylor
- Status changed from inprogress to verify
- Resolution set to fixed
To test: Create a table workspace containing at least one column of string type, save it, reload it back and observe that CheckWorkspacesMatch succeeds where it previously failed.
comment:9 Changed 7 years ago by Samuel Jackson
- Status changed from verify to verifying
- Tester set to Samuel Jackson
comment:10 Changed 7 years ago by Samuel Jackson
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/bugfix/8184_saved_tableworkspace_whitespace'
Full changeset: 1ca115e638e935acfb91139b07acc2c4dbe3968f
comment:11 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 9029
I'll take this as I put the TableWorkspace comparison into CheckWorkspacesMatch. The summary of the solution is that formatting of the output should not be a responsibility of the table workspace.