{"slug": "new-open-source-java-data-library", "title": "New open source Java Data Library", "summary": "CupOfTea Labs released CupOfTea 0.24.0, an open source Java data manipulation library that provides DataFrame-style filtering, aggregation, joins, and statistical operations on a columnar engine using primitive arrays and BitSet null bitmasks. The library requires Java 17 LTS or later and Maven 3.8+ or Gradle 7+, and ships as a modular set of artifacts — cupoftea-core plus optional CSV, JSON, Excel, Parquet, Arrow, Plot, SQL, HTML, YAML, and XML format modules, or the cupoftea-all aggregator. CupOfTea 0.24.0 adds a first-class Schema definition, an NA missing-value model distinct from empty strings, BigDecimal decimal arithmetic, O(n) quantiles and median via Introselect, rolling and expanding windows, and direct mapping to Java Records and POJOs.", "body_md": "CupOfTea is a lightweight library for data manipulation in Java. It provides a simple and efficient API to work with large structured datasets, enabling operations such as filtering, aggregation, joining, and data analysis.\n\n- Create DataFrames from arrays, lists, CSV files, and other sources.\n- First-class `Schema` definition:`Schema.of(\"year\", INT, \"price\", DOUBLE)` .\n- Optional automatic type inference on CSV, JSON, and Excel ingest.\n- First-class missing-value model (`NA` ) distinct from empty strings (`\"\"` ).\n- Full support for `java.time` (`LocalDate` ,`LocalDateTime` ,`Instant` ).\n- Exact currency arithmetic using `BigDecimal` (`Schema.DECIMAL` ).\n- Column selection, row filtering, grouping, aggregation, and slicing operations.\n- Relational joins: `innerJoin` ,`leftJoin` ,`rightJoin` ,`outerJoin` ,`crossJoin` with automatic column deduplication, multi-key support, and customizable suffixes.\n- \n**Statistical Operations & Summary** : High-performance linear$O(n)$ quantiles and median (via Introselect), sample and population variance and standard deviation, skewness, kurtosis, covariance, correlation matrix (`corr()` ), and descriptive summary (`describe()` ).\n- \n**Window, Rolling & Cumulative Functions** : Sliding rolling windows (`df.rolling(w)` ), expanding windows (`df.expanding()` ), cumulative operations (`cumsum` ,`cumprod` ,`cummin` ,`cummax` ), time series shifts (`lead` ,`lag` ,`diff` ,`pctChange` ), and SQL-like analytical window partitioning and ranking (`df.window().partitionBy(...).orderBy(...).rank()` ).\n- Read and write CSV, JSON, Excel, Parquet, and YAML files.\n- \n**DTO & Record Mapping** : Import and export standard Java POJOs/JavaBeans and Java Records directly (`CupOfTea.read().records(...)` ,`df.write().records(...)` ,`CupOfTea.read().dtos(...)` ,`df.write().dtos(...)` ).\n- \n**Columnar Engine** : High-performance contiguous memory layout (`ColumnVector` with primitive`int[]` ,`double[]` ,`long[]` ,`float[]` ,`boolean[]` ,`String[]` , and`BitSet` null bitmasks), eliminating per-cell boxed object overhead and row hash lookups.\n- \n**Unified Mutation Modes** : Fluent`IN_PLACE` builder by default with opt-in`COPY_ON_WRITE` via`.asCopyOnWrite()` and`.asInPlace()` .\n- \n**Deep Copy** : Explicit`.copy()` deep-copy method on`CupOfTea` and`IDataFrame` .\n- \n**Immutable Row API** : Strongly-typed, unmodifiable`Row` objects with typed accessors (`getInt` ,`getString` ,`getDouble` ,`getBoolean` ,`getLocalDate` , etc.) and zero leaking of internal mutable row maps.\n\n- **Java** : Java 17 LTS or later\n- **Build tool** : Maven 3.8+ or Gradle 7+\n\nCupOfTea is modular. You can import only the core engine and whichever IO format modules your project needs, or include `cupoftea-all` for full format support.\n\nAdd the core dependency to your `pom.xml`:\n\n```\n<dependency>\n    <groupId>io.github.cupoftea-labs</groupId>\n    <artifactId>cupoftea-core</artifactId>\n    <version>0.24.0</version>\n</dependency>\n```\n\nAdd optional format modules as needed (CSV, JSON, Excel, Parquet, Arrow, Plot, SQL, HTML, YAML, XML):\n\n``` php\n<!-- Example: Add CSV and JSON format support -->\n<dependency>\n    <groupId>io.github.cupoftea-labs</groupId>\n    <artifactId>cupoftea-csv</artifactId>\n    <version>0.24.0</version>\n</dependency>\n<dependency>\n    <groupId>io.github.cupoftea-labs</groupId>\n    <artifactId>cupoftea-json</artifactId>\n    <version>0.24.0</version>\n</dependency>\n\n<!-- Or import all formats with the aggregator module: -->\n<!--\n<dependency>\n    <groupId>io.github.cupoftea-labs</groupId>\n    <artifactId>cupoftea-all</artifactId>\n    <version>0.24.0</version>\n</dependency>\n-->\n```\n\nFor more details on releases and publishing, see [docs/community/releasing.md](https://github.com/cupoftea-labs/cupoftea/blob/master/docs/community/releasing.md).\n\n**Groovy DSL (`build.gradle`):**\n\n```\n// Core library\nimplementation 'io.github.cupoftea-labs:cupoftea-core:0.24.0'\n\n// Optional format modules\nimplementation 'io.github.cupoftea-labs:cupoftea-csv:0.24.0'\nimplementation 'io.github.cupoftea-labs:cupoftea-json:0.24.0'\n\n// Or all formats at once:\n// implementation 'io.github.cupoftea-labs:cupoftea-all:0.24.0'\n```\n\n**Kotlin DSL (`build.gradle.kts`):**\n\n```\n// Core library\nimplementation(\"io.github.cupoftea-labs:cupoftea-core:0.24.0\")\n\n// Optional format modules\nimplementation(\"io.github.cupoftea-labs:cupoftea-csv:0.24.0\")\nimplementation(\"io.github.cupoftea-labs:cupoftea-json:0.24.0\")\n\n// Or all formats at once:\n// implementation(\"io.github.cupoftea-labs:cupoftea-all:0.24.0\")\n```\n\n| Module | Description | Dependencies / Formats | \n|---|---|---|\n| `cupoftea-core` | Core DataFrame engine, filtering, aggregation, SPI interfaces | Zero heavy external deps | \n| `cupoftea-csv` | CSV format reader and writer | OpenCSV | \n| `cupoftea-json` | JSON format reader and writer | Jackson Databind | \n| `cupoftea-excel` | Excel format reader (.xlsx / .xls) | Apache POI 5.5.1 | \n| `cupoftea-parquet` | Parquet format reader and writer | Apache Parquet / Hadoop | \n| `cupoftea-arrow` | Apache Arrow IPC and Feather zero-copy format reader and writer | Apache Arrow Vector & Netty | \n| `cupoftea-sql` | SQL database reader and writer via JDBC with batching and transaction support | JDBC ( `java.sql` ,`javax.sql` ) | \n| `cupoftea-html` | HTML table reader | Jsoup | \n| `cupoftea-yaml` | YAML format reader and writer | SnakeYAML | \n| `cupoftea-xml` | XML format reader | Standard Java XML DOM | \n| `cupoftea-plot` | Declarative plotting engine (Vega-Lite), HTML export, desktop preview | Jackson Databind | \n| `cupoftea-all` | Meta-module aggregating all format and plot modules | All above formats & plotting | \n\nIO formats are dynamically discovered via `ServiceLoader`. Ensure the corresponding format module is on your classpath:\n\n``` python\nimport com.cupoftea.CupOfTea;\nimport com.cupoftea.table.Row;\nimport com.cupoftea.table.Schema;\nimport static com.cupoftea.table.Schema.*;\nimport java.io.File;\n\npublic class Main {\n    public static void main(String[] args) {\n        // Read CSV using fluent API\n        CupOfTea df = CupOfTea.read().csv(\"data.csv\");\n        df.print();\n\n        // Perform filtering with immutable Row\n        CupOfTea filtered = df.filter(row -> row.getInt(\"age\") != null && row.getInt(\"age\") > 30);\n        filtered.print();\n\n        // Core pandas-like ops:\n        // Selection and dropping of columns (use copy() for independent views)\n        CupOfTea selected = df.copy().select(\"name\", \"age\", \"salary\");\n        CupOfTea withoutDept = df.copy().drop(\"department\");\n\n        // Inspection: head, tail, and slicing\n        df.head(5).print();\n        df.tail(3).print();\n        CupOfTea slice = df.slice(0, 2);\n\n        // Position-based indexing (iloc) with negative index support\n        Row lastRow = df.iloc(-1);\n        Object cell = df.iloc(0, 1);\n        CupOfTea subset = df.iloc().slice(0, 2, 0, 2);\n\n        // Index-based indexing (loc)\n        df.setIndex(\"id\");\n        Row person = df.loc(101);\n        Object name = df.loc(101, \"name\");\n\n        // Missing value imputation & cleaning (using copy() for branching)\n        CupOfTea filled = df.copy().fillna(0);\n        CupOfTea cleaned = df.copy().dropna(); // drops rows with any missing value\n\n        // Relational joins\n        CupOfTea depts = CupOfTea.read().csv(\"departments.csv\");\n        CupOfTea joined = df.innerJoin(depts, \"department\");\n        // Or left, right, outer, cross joins:\n        // CupOfTea left = df.leftJoin(depts, \"department\");\n        // CupOfTea cross = df.crossJoin(depts);\n\n        // DataFrame concatenation (vertical / rows or horizontal / columns)\n        CupOfTea moreData = CupOfTea.read().csv(\"more_data.csv\");\n        CupOfTea stacked = df.concat(moreData); // or CupOfTea.concat(df, moreData)\n\n        // Write to multiple formats\n        filtered.write().csv(\"filtered.csv\");\n        filtered.write().json(\"filtered.json\");\n\n        // Or switch to COPY_ON_WRITE for immutable transformation chains\n        CupOfTea cowDf = df.copy().asCopyOnWrite();\n        CupOfTea withoutSalary = cowDf.removeColumn(\"salary\");\n    }\n}\n```\n\nFormat-specific options can also be configured:\n\n```\n// Read CSV with custom separator\nCupOfTea df = CupOfTea.read().option(\"separator\", \";\").csv(new File(\"data.csv\"));\n```\n\nCupOfTea provides specialized, fluent columnar expressions for string manipulation and date/time feature engineering:\n\n```\n// Vectorized text manipulation\ndf.withColumn(\"name_upper\", df.col(\"name\").str.toUpperCase());\ndf.transformColumn(\"name\", df.col(\"name\").str.trim().capitalize());\n\n// Check prefix, suffix, and containment (returns BooleanColumnVector)\nBooleanColumnVector isEng = df.col(\"department\").str.startsWith(\"Eng\");\n\n// Vectorized temporal operations\ndf.withColumn(\"hire_year\", df.col(\"hire_date\").dt.year());\ndf.withColumn(\"days_since\", df.col(\"hire_date\").dt.daysBetween(LocalDate.now()));\ndf.transformColumn(\"hire_date\", df.col(\"hire_date\").dt.plusMonths(6));\n```\n\nCupOfTea provides a declarative plotting API (`df.plot()`) backed by Vega-Lite specifications, producing standalone responsive HTML charts with zero heavy external GUI or native dependencies:\n\n```\nCupOfTea df = CupOfTea.read().csv(\"data.csv\");\n\n// Scatter plot with title, custom labels and desktop preview\ndf.plot().scatter(\"experience\", \"salary\")\n        .title(\"Salary vs Experience\")\n        .show();\n\n// Histogram with custom binning\ndf.plot().hist(\"age\", 20).show();\n\n// Grouped bar chart saved to standalone interactive HTML file\ndf.plot().bar(\"department\", \"headcount\").saveHtml(\"chart.html\");\n\n// Box plot comparing salary distributions across departments\ndf.plot().box(\"department\", \"salary\").show();\n\n// Line chart, area chart, and 2D heatmap matrix\ndf.plot().line(\"year\", \"revenue\").show();\ndf.plot().area(\"date\", \"active_users\").show();\ndf.plot().heatmap(\"department\", \"job_level\", \"headcount\").show();\n```\n\n- \n**Interactive HTML Table (`df.toHtml()`)** :\nRenders responsive HTML with sticky column headers, data type indicators, and client-side pagination:\n\n```\nString html = df.toHtml(); // Default pagination with 25 rows per page\nString fullDoc = df.toHtml(TableHtmlConfiguration.builder().pageSize(50).fullDocument(true).build());\n```\n\n- \n**Seamless Jupyter / IJava Cell Rendering** :`CupOfTea` ,`IDataFrame` , and`Chart` objects implement the standard notebook MIME rendering contract (`renderHtml()` and`render()` returning`text/html` ). When a DataFrame or chart expression is evaluated in a Jupyter cell (via IJava or Polyglot Notebooks), it renders natively and interactively inside the cell output area.\n\nCupOfTea supports multi-threaded parallel execution across row filtering, column mapping, whole-DataFrame aggregations, and GroupBy operations using vectorized chunking and prefix-sum scans:\n\n```\n// Switch to parallel execution mode (using ForkJoinPool.commonPool())\nCupOfTea parDf = df.asParallel();\n\n// Custom thread pool and parallel threshold\nExecutorService customPool = Executors.newFixedThreadPool(8);\ndf.parallel(customPool).withParallelThreshold(50_000);\n\n// Parallel filtering with zero-copy vectorized chunking\nCupOfTea filtered = parDf.filter(row -> row.getDouble(\"salary\") > 80_000.0);\n\n// Parallel column transformations\nparDf.mapDouble(\"salary\", s -> s * 1.10);\n\n// Parallel whole-DataFrame aggregations\nObject totalRevenue = parDf.sumOf(\"revenue\");\nDouble avgScore = parDf.meanOf(\"score\");\n\n// Parallel chunk-partitioned GroupBy aggregations\nCupOfTea summary = parDf.groupBy(\"department\").agg(\n    Aggregations.sum(\"salary\"),\n    Aggregations.mean(\"experience\"),\n    Aggregations.count(\"employee_id\")\n);\n\n// Switch back to sequential single-threaded execution\nCupOfTea seqDf = parDf.asSequential();\n```\n\n- Window and rolling functions.\n- Time series resampling and frequency conversion.\n\nContributions are welcome! To contribute, follow these steps:\n\n1. Fork the repository.\n2. Create a branch for your feature (`git checkout -b my-feature` ).\n3. Commit your changes (`git commit -m 'Add new feature'` ).\n4. Push to the branch (`git push origin my-feature` ).\n5. Open a pull request.\n\nThis project is licensed under the [Apache License, Version 2.0](https://github.com/cupoftea-labs/cupoftea/blob/master/LICENSE). See the [LICENSE](https://github.com/cupoftea-labs/cupoftea/blob/master/LICENSE) file for the full license text.", "url": "https://wpnews.pro/news/new-open-source-java-data-library", "canonical_source": "https://github.com/cupoftea-labs/cupoftea", "published_at": "2026-11-06 21:06:35+00:00", "updated_at": "2026-11-06 21:20:09.013945+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["CupOfTea Labs", "CupOfTea", "Java", "Maven", "Gradle"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/new-open-source-java-data-library", "markdown": "https://wpnews.pro/news/new-open-source-java-data-library.md", "text": "https://wpnews.pro/news/new-open-source-java-data-library.txt", "jsonld": "https://wpnews.pro/news/new-open-source-java-data-library.jsonld"}}