ConeyLiu commented on code in PR #2987:
URL: https://github.com/apache/parquet-java/pull/2987#discussion_r1718049826
##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java:
##########
@@ -1707,19 +1707,27 @@ private static void serializeColumnIndexes(
}
long offset = out.getPos();
Util.writeColumnIndex(columnIndex, out, columnIndexEncryptor,
columnIndexAAD);
- column.setColumnIndexReference(new IndexReference(offset, (int)
(out.getPos() - offset)));
+ column.setColumnIndexReference(new IndexReference(offset,
toIntWithCheck(out.getPos() - offset)));
}
}
}
- private int toIntWithCheck(long size) {
+ private static int toIntWithCheck(long size) {
if ((int) size != size) {
throw new ParquetEncodingException(
"Cannot write page larger than " + Integer.MAX_VALUE + " bytes: " +
size);
}
return (int) size;
}
+ private static int footerSizeToInt(long size) {
+ if ((int) size != size) {
+ throw new ParquetFileWriteException(
Review Comment:
Changed to ParquetSizeOverflowException, and removed the `footerSizeToInt`.
The `toIntWithCheck` is a common method, it would be better to move to the
common module. There is already a common utils class `Ints`, however, it is
deprecated. Maybe we can enable it since we can provide more information than
`Math.toIntExact`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]