[
https://issues.apache.org/jira/browse/PARQUET-2052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17349467#comment-17349467
]
ASF GitHub Bot commented on PARQUET-2052:
-----------------------------------------
sunchao commented on a change in pull request #910:
URL: https://github.com/apache/parquet-mr/pull/910#discussion_r637214427
##########
File path:
parquet-column/src/main/java/org/apache/parquet/column/values/dictionary/DictionaryValuesWriter.java
##########
@@ -173,7 +173,7 @@ public BytesInput getBytes() {
BytesInput bytes = concat(BytesInput.from(bytesHeader), rleEncodedBytes);
// remember size of dictionary when we last wrote a page
lastUsedDictionarySize = getDictionarySize();
- lastUsedDictionaryByteSize = dictionaryByteSize;
+ lastUsedDictionaryByteSize = (int) dictionaryByteSize;
Review comment:
Okay. Changed to `Math.toIntExact` so it will throw exception when
overflow.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> Integer overflow when writing huge binary using dictionary encoding
> -------------------------------------------------------------------
>
> Key: PARQUET-2052
> URL: https://issues.apache.org/jira/browse/PARQUET-2052
> Project: Parquet
> Issue Type: Bug
> Reporter: Chao Sun
> Assignee: Chao Sun
> Priority: Major
>
> To check whether it should fallback to plain encoding,
> {{DictionaryValuesWriter}} currently use two variables:
> {{dictionaryByteSize}} and {{maxDictionaryByteSize}}, both of which are
> integer. This will cause issue when one first writes a relatively small
> binary within the threshold and then write a huge string which cause
> {{dictionaryByteSize}} overflow and becoming negative.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)