Library / SDK
apache/datasketches-java avatar
apache/datasketches-java

Apache DataSketches Java: a core sketch library with a strict build contract

A software library of stochastic streaming algorithms, a.k.a. sketches.

957 stars227 forksJavaApache-2.0

At a glance

What is it?
Apache DataSketches Java packages stochastic streaming algorithms as a plain Maven dependency, with each major release pinned to a specific JDK and a build that demands a declared toolchain plus a path made of Java identifier characters.
Who is it for?
Adopt Apache DataSketches Java when you need approximate summaries of a large or unbounded event stream and your stack already runs on the JVM, since the artifact is a dependency you add to a classpath and the licence is Apache-2.0, and the repository is not archived with a last push on 2026-10-18. Do not adopt it for small bounded windows where exact aggregation is cheap, and do not treat a sketch as a substitute for exact counts.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 5 days ago.
What is it written in?
Mainly Java, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Why a sketch library exists for unbounded streams

Apache DataSketches Java exists for a narrow but common problem: a process receives more events over time than it can hold on to, and somebody still wants to know what the stream looked like. The project describes itself as a software library of stochastic streaming algorithms, also known as sketches. Those algorithms keep a probabilistic summary of what has passed through, so a caller can query the summary instead of the full history.

That shape matters more than the language binding. In any pipeline where input volume is decided by someone else's traffic, the expensive part is not the first million events, it is the tenth billion. A sketch turns a question about the whole stream into a fixed size answer at a bounded cost per event.

The audience is Java engineers building streaming or batch analytics, and teams who already embed the library further down the stack. The README notes that this core component is also a dependency of other components of the library that create adaptors for target systems, such as the Apache Pig adaptor and the Apache Hive adaptor. If your query engine is one of those, sketches may already be running inside it without you importing anything yourself.

A core library with adaptor satellites, not a service

This is a core library with satellites, not a standalone application. The README is explicit that the core Java component "contains all of the sketching algorithms and can be accessed directly from user applications". Other components of the library adapt these algorithms to target systems, such as Apache Pig and Apache Hive.

The repository layout backs that up. The top level holds pom.xml,.mvn/, src/, tools/,.github/, and the usual Apache licence files LICENSE and NOTICE. There is no separate service, no server module, no configuration tree. The tools/ directory exists for build related resources such as the SpotBugs exclusion file discussed further down.

Two consequences follow. First, the unit of adoption is a Maven artifact you place on a classpath, not a deployment you operate and monitor. Second, the algorithms travel: the README lists parallel core library components for C++, Python, GO, and Rust that implement many of the same sketch algorithms. A team already running one of those runtimes can solve the same summarisation problem without leaving it, which makes the Java component one option among several rather than the single reference implementation.

Building on Java 25 with a declared Maven toolchain

Compilation and test are done with Maven, and the README calls Maven the recommended tool for compile and test. Two environment requirements come before any goal runs.

The first is a JDK. The current release line requires an OpenJDK-compatible build of Java 25 at minimum, and the project states that all testing of the release was performed with the Eclipse Temurin build. The second is a Maven toolchain: the README requires a JDK type toolchain defined at ~/.m2/toolchains.xml that specifies where to find a locally installed OpenJDK-compatible version 25, and it warns that the paths in the toolchain must be fully qualified direct paths because using environment variables will not work. Your default $JAVA_HOME compiler must be OpenJDK compatible and may be a version greater than 25, in which case Maven automatically uses the Java 25 version from the toolchain.

With that in place the normal unit test run is a single goal:

bash
$ mvn clean test

To install jars built from the downloaded source into your local Maven repository:

bash
$ mvn clean install -DskipTests=true

That install creates five artifacts with the same X.Y.Z pattern: datasketches-java-X.Y.Z.jar with the compiled main class files, datasketches-java-X.Y.Z-tests.jar with the compiled test class files, datasketches-java-X.Y.Z-sources.jar with the main source files, datasketches-java-X.Y.Z-test-sources.jar with the test source files, and datasketches-java-X.Y.Z-javadoc.jar with the compressed Javadocs.

The installation path must be a legal Java identifier

Building the library is not the same as placing it anywhere on disk, and the project is unusually direct about one constraint: the directory elements of the full absolute path of the target installation directory must qualify as Java identifiers. No space characters, no other non-Java identifier characters, in any path element.

The stated reason is the Oracle Java Specification, which the README links, and which requires location-independent access to resources. This component accesses resource files for testing, so a path with a space in it breaks the assumption the test phase relies on.

Practically that rules out very common locations. A user profile under a path containing a space, a shared drive, or a directory name with punctuation are all candidates for failure, and the failure appears during the test run rather than during compilation, which is a confusing place to meet it for the first time.

The workaround is unexciting and dependable: use a path made only of Java identifier characters, with plain ASCII names, and point both the toolchain and the checkout at it. The README does not document a way to relax the requirement, so path hygiene has to be part of your build setup rather than something you discover during an incident.

SpotBugs needs its exclusion file and Checkstyle lags Java 25

The build tooling around the library has two known gaps that the project itself flags, and both of them shape the cost of a local or CI setup.

SpotBugs is the first. The README says to configure SpotBugs with the /tools/FindBugsExcludeFilter.xml file, and warns that otherwise you may get a lot of false positive or low risk issues that have already been examined and eliminated with that exclusion file. The path is repository relative, so the file ships in the checkout, but an analysis job that runs without pointing at it will report issues the maintainers consider handled.

Checkstyle is the second and harder constraint. The README states that at the time of writing Checkstyle had not been upgraded to handle Java 25 features. In practice the style rules do not fully understand the syntax of the JDK the project targets, so lint output on newer language constructs should not be read as meaningful.

Neither issue touches the algorithms at runtime. Both touch anyone who compiles the sources downstream, keeps a fork, or wires the library into a build that enforces its own quality gates.

Major versions track JDK majors and force an upgrade decision

The release history ties the library's major versions to Java releases. Version 9.0.0 is labelled Apache Release DataSketches-Java 9.0.0 for Java 25 and is dated 2025-12-02. Version 8.0.0 for Java 21 is dated 2025-04-15, and version 7.0.1 for Java 17 is dated 2025-01-22.

That pairing is the main upgrade cost to plan for. Moving between major versions means moving between JDK lines, and the toolchain requirement changes with it: a build on the 9.0.0 line needs a Java 25 toolchain defined, not merely a newer $JAVA_HOME. A team that standardises on one JDK per service should treat a DataSketches major upgrade as a JDK upgrade that happens to carry a library dependency.

The repository is not archived, and the last push was on 2026-10-18, so the source is current rather than abandoned. The licence is Apache-2.0, the standard permissive Apache grant, and the NOTICE file sits alongside LICENSE at the repository root. As with any Apache-2.0 component, the licence terms are a question for your own counsel, while the engineering obligation is to keep the NOTICE file travelling with redistributed jars.

Where a sketch is the wrong instrument

The Java component is not the only route to these algorithms, and the design has clear boundaries.

One alternative is the other language components. The README points to parallel core library components for C++, Python, GO, and Rust that implement many of the same sketch algorithms. The practical difference is runtime fit and coverage rather than algorithmic quality: a service that is already a Python or Rust process can take the algorithm natively instead of crossing a JVM boundary, while the word many implies the ported set does not necessarily match the Java component exactly.

The other alternative is the opposite design, keeping the data. Exact aggregation over a bounded window produces exact answers and avoids the approximation implied by the word stochastic. That approach wins when the window is small enough to hold and when boundary precision matters more than memory, and it loses exactly when volume is unbounded, which is the situation these algorithms were created for.

The wrong tool cases follow from that. For a small bounded window, a sketch adds error nobody asked for. When you need guaranteed precision on rare events, a probabilistic summary is the wrong instrument. And if your runtime is not the JVM and the ported algorithm set does not cover your case, this particular component is not the way in.

Editorial conclusion

Adopt Apache DataSketches Java when you need approximate summaries of a large or unbounded event stream and your stack already runs on the JVM, since the artifact is a dependency you add to a classpath and the licence is Apache-2.0, and the repository is not archived with a last push on 2026-10-18. Do not adopt it for small bounded windows where exact aggregation is cheap, and do not treat a sketch as a substitute for exact counts. Before you commit, verify two things in your own environment: that the absolute path of your checkout contains no space or other non-identifier characters, and that a JDK type toolchain for Java 25 is defined at ~/.m2/toolchains.xml with fully qualified paths.

Frequently asked questions

Which Java version does Apache DataSketches Java require?

The current release line requires an OpenJDK-compatible build of Java 25 at minimum, and the README states that all testing of the release has been performed with the Eclipse Temurin build. Releases are versioned against Java majors, with 9.0.0 for Java 25, 8.0.0 for Java 21 and 7.0.1 for Java 17.

How do I build and install the Apache DataSketches Java jars?

Maven is the recommended tool. Run mvn clean test for the normal unit tests, or mvn clean install -DskipTests=true to install jars built from the downloaded source. A JDK type toolchain for OpenJDK-compatible Java 25 must be defined at ~/.m2/toolchains.xml with fully qualified direct paths.

Does Apache DataSketches offer implementations for languages other than Java?

The README lists parallel core library components for C++, Python, GO and Rust that implement many of the same sketch algorithms. The Java core component also serves as the dependency behind adaptors for target systems such as the Apache Pig adaptor and the Apache Hive adaptor.

Why do my SpotBugs runs report many low risk issues in Apache DataSketches Java?

The README says to configure SpotBugs with the /tools/FindBugsExcludeFilter.xml file. Without it you may get a lot of false positive or low risk issues that the project has already examined and eliminated with that exclusion file.

Official sources

  1. apache/datasketches-java on GitHub
  2. License: Apache-2.0
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/apache-datasketches-java.svg)](https://hysenlabs.com/projects/apache-datasketches-java)

Was this useful?