Skip to content

chore(deps): Upgrade jol-core to latest#143

Merged
tdcmeehan merged 2 commits intoprestodb:masterfrom
mblanco-denodo:issue/presto/24005
Feb 19, 2026
Merged

chore(deps): Upgrade jol-core to latest#143
tdcmeehan merged 2 commits intoprestodb:masterfrom
mblanco-denodo:issue/presto/24005

Conversation

@mblanco-denodo
Copy link
Copy Markdown

@mblanco-denodo mblanco-denodo requested a review from a team as a code owner February 12, 2026 12:25
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Feb 12, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Upgrades the stats module’s jol-core dependency (and related build plugins/parent) and adjusts memory-size estimation APIs and constants from int to long to be compatible with the newer JOL version and larger instance sizes.

Class diagram for updated memory size estimation APIs

classDiagram
    class HllInstance {
        <<interface>>
        +int getIndexBitLength()
        +long estimatedInMemorySize()
        +int estimatedSerializedSize()
    }

    class DenseHll {
        -static final long DENSE_INSTANCE_SIZE
        -static final int OVERFLOW_GROW_INCREMENT
        -byte indexBitLength
        +void insertHash(long hash)
        +long cardinality()
        +long estimatedInMemorySize()
    }

    class SparseHll {
        <<final>>
        -static final long SPARSE_INSTANCE_SIZE
        +long cardinality()
        +long estimatedInMemorySize()
    }

    class HyperLogLog {
        -static final long INSTANCE_SIZE
        -static final int MAX_NUMBER_OF_BUCKETS
        -HllInstance instance
        +void add(long value)
        +void addHash(long hash)
        +long cardinality()
        +void eachBucket(BucketListener listener)
        +long estimatedInMemorySize()
    }

    class QuantileDigest {
        -static final int MAX_BITS
        -static final long QUANTILE_DIGEST_SIZE
    }

    HllInstance <|.. DenseHll
    HllInstance <|.. SparseHll
    HyperLogLog o-- HllInstance
Loading

File-Level Changes

Change Details Files
Broaden in-memory size accounting from int to long across HLL implementations and QuantileDigest to support larger sizes and updated JOL APIs.
  • Change static instance size constants from int to long where populated via ClassLayout.instanceSize()
  • Update HllInstance.estimatedInMemorySize() signature from int to long and propagate to DenseHll, SparseHll, HyperLogLog and related tests
  • Adjust estimatedInMemorySize implementations to return long-typed results and avoid narrowing casts
stats/src/main/java/com/facebook/airlift/stats/cardinality/DenseHll.java
stats/src/main/java/com/facebook/airlift/stats/cardinality/HyperLogLog.java
stats/src/main/java/com/facebook/airlift/stats/cardinality/SparseHll.java
stats/src/main/java/com/facebook/airlift/stats/cardinality/HllInstance.java
stats/src/main/java/com/facebook/airlift/stats/QuantileDigest.java
stats/src/test/java/com/facebook/airlift/stats/cardinality/TestSparseHll.java
Upgrade build dependencies to align with newer jol-core and airbase versions.
  • Bump org.openjdk.jol:jol-core from 0.2 to 0.17
  • Add an explicit io.airlift:slice 0.45 dependency in stats module
  • Update maven-plugin-plugin and maven-shade-plugin versions in drift module pom
  • Bump project parent com.facebook.airlift:airbase from 108 to 109-SNAPSHOT
stats/pom.xml
drift/pom.xml
pom.xml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Changing estimatedInMemorySize() from int to long (e.g., in HllInstance and HyperLogLog) is a public API break; consider whether a backwards-compatible approach (e.g., adding a new long-returning method and deprecating the old one) is needed for downstream users.
  • The parent airbase version was updated to 109-SNAPSHOT; for a released branch/module you may want to depend on a non-SNAPSHOT version to avoid build instability and implicit behavior changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing `estimatedInMemorySize()` from `int` to `long` (e.g., in `HllInstance` and `HyperLogLog`) is a public API break; consider whether a backwards-compatible approach (e.g., adding a new `long`-returning method and deprecating the old one) is needed for downstream users.
- The parent `airbase` version was updated to `109-SNAPSHOT`; for a released branch/module you may want to depend on a non-SNAPSHOT version to avoid build instability and implicit behavior changes.

## Individual Comments

### Comment 1
<location> `stats/src/main/java/com/facebook/airlift/stats/cardinality/SparseHll.java:195-197` </location>
<code_context>

     @Override
-    public int estimatedInMemorySize()
+    public long estimatedInMemorySize()
     {
-        return (int) (DENSE_INSTANCE_SIZE +
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Avoid narrowing to int in estimatedInMemorySize now that it returns long

Since `estimatedInMemorySize()` now returns a `long`, using `toIntExact(sizeOf(entries))` adds an unnecessary narrowing step and can overflow. Consider returning `SPARSE_INSTANCE_SIZE + sizeOf(entries)` directly as a `long` to keep the calculation in `long` space. If you do need to preserve the prior `int`-based behavior, please add a short comment explaining why overflow is acceptable here.

Suggested implementation:

```java
    @Override
    public long estimatedInMemorySize()
    {
        return SPARSE_INSTANCE_SIZE + sizeOf(entries);
    }

```

If this file (or a common import section for this class) includes a static import for `toIntExact`, such as:

```java
import static java.lang.Math.toIntExact;
```

that import should be removed, since it will no longer be used.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +195 to 197
public long estimatedInMemorySize()
{
return SPARSE_INSTANCE_SIZE + toIntExact(sizeOf(entries));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Avoid narrowing to int in estimatedInMemorySize now that it returns long

Since estimatedInMemorySize() now returns a long, using toIntExact(sizeOf(entries)) adds an unnecessary narrowing step and can overflow. Consider returning SPARSE_INSTANCE_SIZE + sizeOf(entries) directly as a long to keep the calculation in long space. If you do need to preserve the prior int-based behavior, please add a short comment explaining why overflow is acceptable here.

Suggested implementation:

    @Override
    public long estimatedInMemorySize()
    {
        return SPARSE_INSTANCE_SIZE + sizeOf(entries);
    }

If this file (or a common import section for this class) includes a static import for toIntExact, such as:

import static java.lang.Math.toIntExact;

that import should be removed, since it will no longer be used.

@sonarqubecloud
Copy link
Copy Markdown

@tdcmeehan tdcmeehan merged commit 27cd9ab into prestodb:master Feb 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants