[DWRF] Bug in low memory mode

Summary:
There's a bug in the string and integer tree writers when using the dictionary encoding, which only occurs when the writers enter low memory mode before the first index stride is written out.  If this happens, when the columns are converted from dictionary encoding to direct encoding, it will fail to create an index entry for the first index stride, which causes an IndexOutOfBoundsException later when the data is being read.

The fix just creates the row index entry if it's needed.

Test Plan:
Rewrote some partitions which ran into this issue and verified I could read them.

Added test cases.

Running ptests
[DWRF] Another bug in low memory mode

Summary: If a string column is written out directly and it's writing the stripe corresponding to the end of the hive.exec.orc.encoding.interval and at the same time it switches to low memory mode, it will not enter the if block to convert the dictionary encoded data to direct encoding.  This is because use dictionary encoding is false, but use carried over direct encoding is also false.  Due to this the data in the dictionary is lost.

Test Plan:
Added a unit test.

Ptests pass.
[DWRF] Yet another bug in low memory mode

Summary:
There is a bug in low memory where if low memory mode is entered in a stride (other than the first) and not enough rows are written to the strip to finish off this stride (e.g. if the number of rows in a stride is 10,000 rows, low memory mode is entered after writing 1000 rows to the stride and any number less than 9000 rows are written before the stripe is flushed) then the index entry will not be populated with the positions for that stride.

To fix this I added a check, if dictionary encoding is being used, and the number of saved indeces is > 0 then write out index entries for the number of saved indeces + 1.  This is because if we are in this case, we must be converting from a dictionary to direct encoding.  So write out an index entry for every stride we've finished so far, plus the one we're currently working on.

Test Plan:
Added a testcases to demonstrate these.  Also added a couple test cases for other edge cases I could think of.

ptests pass