Skip to content

Commit

Permalink
Use toIntExact in PrimitiveColumnWriter to cast long to int safely
Browse files Browse the repository at this point in the history
  • Loading branch information
raunaqmorarka committed Jul 19, 2022
1 parent 822f43e commit 35f6831
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -230,8 +230,8 @@ private void flushCurrentPageToBuffer()
columnStatistics.mergeStatistics(statistics);

ByteArrayOutputStream pageHeaderOutputStream = new ByteArrayOutputStream();
parquetMetadataConverter.writeDataPageV1Header((int) uncompressedSize,
(int) compressedSize,
parquetMetadataConverter.writeDataPageV1Header(toIntExact(uncompressedSize),
toIntExact(compressedSize),
valueCount,
repetitionLevelWriter.getEncoding(),
definitionLevelWriter.getEncoding(),
Expand Down Expand Up @@ -284,7 +284,8 @@ private List<ParquetDataOutput> getDataStreams()
long compressedSize = pageData.size();

ByteArrayOutputStream dictStream = new ByteArrayOutputStream();
parquetMetadataConverter.writeDictionaryPageHeader(toIntExact(uncompressedSize),
parquetMetadataConverter.writeDictionaryPageHeader(
toIntExact(uncompressedSize),
toIntExact(compressedSize),
dictionaryPage.getDictionarySize(),
dictionaryPage.getEncoding(),
Expand Down

0 comments on commit 35f6831

Please sign in to comment.