Skip to content

Commit

Permalink
Fix reading of plain dictionary with zero length
Browse files Browse the repository at this point in the history
  • Loading branch information
aloncatz authored and aloneguid committed Feb 23, 2021
1 parent 8273012 commit 9dda79f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Parquet/File/DataColumnReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,10 @@ private static int ReadPlainDictionary(BinaryReader reader, int maxReadCount, in
int start = offset;
int bitWidth = reader.ReadByte();

int length = GetRemainingLength(reader);

//when bit width is zero reader must stop and just repeat zero maxValue number of times
if (bitWidth == 0)
if (bitWidth == 0 || length == 0)
{
for (int i = 0; i < maxReadCount; i++)
{
Expand All @@ -275,7 +277,6 @@ private static int ReadPlainDictionary(BinaryReader reader, int maxReadCount, in
}
else
{
int length = GetRemainingLength(reader);
offset += RunLengthBitPackingHybridValuesReader.ReadRleBitpackedHybrid(reader, bitWidth, length, dest, offset, maxReadCount);
}

Expand Down

0 comments on commit 9dda79f

Please sign in to comment.