PLR Unconversion


We currently have no PLR unconverter. I'd like to document some notes here in the tracker so I don't lose track of them...

If I assume I want to write the PLR backwards (fair assumption given the PLR is a set of shared length arrays) then this would be the pattern for each field (starting at the last one):
  • If the field is null, and no fields have yet been written, don't write anything
  • If the field is null, and fields have been written, write an array of missing values
  • If the field is not null...
    • Throw a SharedLengthViolation if the array length is not equal to that previously written
    • Write the array
The problem with that pattern is what if the length of the last array (or first if thinking backwards) is shorter than the lengths of the other arrays? For example, GroupRadixes has a length of 50, GroupModes is null, and GroupIndexes has a length of 100. The unconverter would then write a 50-length array of UInt16.MinValue, instead of what it should write, a 100-length array.

I can see fixing this two ways:
  1. Upon encountering a null field that should be written as an array of missing values, yet only one field has been written and that one field was an array that allowed truncation, look ahead to the next non-null array with the same ArrayLengthFieldIndex to get the correct array length.
  2. Before writing anything, investigate the maximum array length to discover the group count, and use that for writing null arrays that need to be populated with missing values.
Option 2 seems much simpler at this point...
Closed Apr 11, 2012 at 4:22 PM by Selzhanik


Selzhanik wrote Apr 11, 2012 at 4:22 PM