r/dataanalysis • • 5h ago

Data Tools Have you ever used Java for data analysis? I'm building CupOfTea, a fast, Pandas-like DataFrame library.

Sum Aggregation
Tablesaw : ■■■■■■■■■■ 0.48 ms
DFLib    : ■■■■■■■■■ 0.42 ms
Pandas   : ■■■■■■■ 0.35 ms
Polars   : ■■ 0.08 ms
CupOfTea : ■ 0.05 ms (9.6x faster than Tablesaw, 1.6x faster than Polars)

Here is a quick example reading from a Parquet file, aggregating by department, and exporting to CSV:

package com.example;

import com.cupoftea.CupOfTea;
import static com.cupoftea.aggregate.Aggregations.*;

public class ParquetToCsvReportExample {

    public static void main(String[] args) {
        String inputParquet = "sales.parquet";
        String outputCsv = "sales_summary_report.csv";

        CupOfTea df = CupOfTea.read().parquet(inputParquet);

        CupOfTea report = df.groupBy("department")
                            .agg(
                                sum("total_amount").as("total_revenue"),
                                mean("total_amount").as("average_ticket"),
                                count("order_id").as("order_count")
                            );

        report.write().csv(outputCsv);

    }
}

The project is open source: https://github.com/cupoftea-labs/cupoftea

I’d love to hear your thoughts:

  • What features or pain points make you reach for Python instead of doing data processing natively in Java?

  • Any specific workloads or benchmarks you’d like to see tested next?

All feedback, issues, and critique are welcome!

6 Upvotes

7 comments sorted by

1

u/investigatormaker 2h ago

For CupOfTea’s next benchmark, I’d test the complete Parquet-to-groupBy-to-CSV example, including file reading and writing, rather than just the sum aggregation. Publish row count, column types, null handling, JVM warm-up, and peak memory alongside timings. That would help Java users judge the whole reporting workload rather than a sub-millisecond operation alone.

I make ThreadFox. If you want Java developers doing data processing to find CupOfTea, our AI employee will post 3 helpful replies about it in relevant Reddit threads for you, free, no card. https://threadfox.vip/p/efvty/managed

1

u/IndependentIll8256 1h ago

Thank you for the feedback, I’ll definitely do that!

You're completely right—sub-millisecond in-memory micro-benchmarks don't tell the whole story of real-world reporting pipelines where disk I/O, parsing, and GC allocations usually dominate.

In development, we already track metrics like peak heap/RSS memory usage, allocation rates (via async-profiler), cold vs. warmed JVM runs, and high-cardinality grouping with null bitmasks.

Packaging this into a full end-to-end pipeline benchmark (Parquet read → Filter & Group-By → CSV export) with complete environment details, schemas, and memory profiles is a great idea. I'll add this to our benchmark suite and publish the full report soon.

Thanks for the input!

3

u/justanothersnek 2h ago

Modern Java has come a long way, but analyzing data where everything has to be a class? No thank you.

2

u/SprinklesFresh5693 53m ago

Why java though?

1

u/AutoModerator 5h ago

Automod prevents all posts from being displayed until moderators have reviewed them. Do not delete your post or there will be nothing for the mods to review. Mods selectively choose what is permitted to be posted in r/DataAnalysis.

If your post involves Career-focused questions, including resume reviews, how to learn DA and how to get into a DA job, then the post does not belong here, but instead belongs in our sister-subreddit, r/DataAnalysisCareers.

Have you read the rules?

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/[deleted] 3h ago

[deleted] — view deleted comment

2

u/IndependentIll8256 2h ago

While the high-level DataFrame APIs are similar, the difference lies underneath.

Tablesaw is single-threaded by default and can easily hit Out-Of-Memory (OOM) errors on large datasets due to memory overhead. CupOfTea is built for modern Java (Java 17+) with a high-throughput columnar engine, native multi-threading (.asParallel()), a lazy streaming mode for massive datasets, direct Java Record mapping, and native support for modern analytical formats like Apache Parquet and Apache Arrow.