This is an automated email from the ASF dual-hosted git repository.
rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 889ed7b3ec Trivial fix on a warning detected by static checker (#10492)
889ed7b3ec is described below
commit 889ed7b3ec26b3b8fe47f5b0748f3bf6d2de92fb
Author: Gonzalo Ortiz Jaureguizar <[email protected]>
AuthorDate: Tue Mar 28 22:12:57 2023 +0200
Trivial fix on a warning detected by static checker (#10492)
Older code was:
```
long dictionarySize = info.getDistinctValueCount() *
spec.getDataType().size();
```
This could produce an overflow if the number of distinct values is close to
Integer.MAX_INT / 4, which seems rare, but possible.
New code just cast one of the members as long in order to be sure that
64bit product is used.
---
.../segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
index 236a60d955..7ab6259c48 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java
@@ -363,7 +363,7 @@ public class SegmentColumnarIndexCreator implements
SegmentCreator {
private boolean
shouldCreateDictionaryWithinThreshold(ColumnIndexCreationInfo info,
SegmentGeneratorConfig config, FieldSpec spec) {
- long dictionarySize = info.getDistinctValueCount() *
spec.getDataType().size();
+ long dictionarySize = info.getDistinctValueCount() * (long)
spec.getDataType().size();
long forwardIndexSize =
((long) info.getTotalNumberOfEntries()
* PinotDataBitSet.getNumBitsPerValue(info.getDistinctValueCount()
- 1) + Byte.SIZE - 1) / Byte.SIZE;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]