|
| 1 | +# Changelog |
| 2 | + |
| 3 | +All notable changes to SQL4Json are documented in this file. |
| 4 | + |
| 5 | +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), |
| 6 | +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 7 | + |
| 8 | +## [1.0.0] - 2026-04-10 |
| 9 | + |
| 10 | +Initial public release. |
| 11 | + |
| 12 | +### Core Query Engine |
| 13 | +- SQL SELECT parsing via ANTLR4 grammar (case-insensitive keywords) |
| 14 | +- Pipeline-based query execution: WHERE → GROUP BY → HAVING → WINDOW → ORDER BY → LIMIT → SELECT → DISTINCT |
| 15 | +- Lazy streaming evaluation for WHERE and SELECT stages; materializing stages for GROUP BY, WINDOW, and ORDER BY |
| 16 | +- Hash join execution for multi-source JOIN queries |
| 17 | +- Nested JSON flattening with path-based field keys and query-scoped string interning |
| 18 | +- Streaming JSON parser for efficient processing of large root arrays |
| 19 | +- Zero external runtime dependencies beyond the ANTLR4 runtime |
| 20 | + |
| 21 | +### SQL Syntax |
| 22 | +- **SELECT** with `*`, specific columns, aliases (`AS`), and dot-notation aliases for structured nested output |
| 23 | +- **FROM** with root reference (`$r`), nested path drilling (`$r.response.data`), table names for JOINs, and subqueries |
| 24 | +- **JOIN** / **INNER JOIN**, **LEFT JOIN**, **RIGHT JOIN** with equality `ON` conditions (single or multi-column via `AND`); chained JOINs supported |
| 25 | +- **WHERE** with comparison (`=`, `!=`, `>`, `<`, `>=`, `<=`), pattern matching (`LIKE`, `NOT LIKE`), range (`BETWEEN`, `NOT BETWEEN`), set membership (`IN`, `NOT IN`), and null checks (`IS NULL`, `IS NOT NULL`) |
| 26 | +- **GROUP BY** with multiple columns and `HAVING` filter on aggregated aliases |
| 27 | +- **ORDER BY** with `ASC`/`DESC` on multiple columns and expressions |
| 28 | +- **LIMIT** and **OFFSET** for pagination |
| 29 | +- **DISTINCT** for duplicate row elimination |
| 30 | +- **Subqueries** in FROM clause (nesting depth bounded by a configurable limit) |
| 31 | +- Logical connectives `AND` / `OR` with parenthesized grouping |
| 32 | +- Arbitrary nesting of function calls in SELECT, WHERE, GROUP BY, ORDER BY, and HAVING |
| 33 | +- **CASE expressions:** Simple (`CASE expr WHEN val THEN result END`) and searched (`CASE WHEN condition THEN result END`) forms, usable in SELECT, WHERE, ORDER BY, GROUP BY, and HAVING with full nesting support |
| 34 | + |
| 35 | +### Scalar & Aggregate Functions |
| 36 | +- **String (13):** LOWER, UPPER (with locale support), CONCAT, SUBSTRING, TRIM, LENGTH, REPLACE, LEFT, RIGHT, LPAD, RPAD, REVERSE, POSITION |
| 37 | +- **Math (8):** ABS, ROUND, CEIL, FLOOR, MOD, POWER, SQRT, SIGN |
| 38 | +- **Date/Time (10):** TO_DATE (with optional format), NOW, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, DATE_ADD, DATE_DIFF |
| 39 | +- **Conversion (3):** CAST (7 target types: STRING, NUMBER, INTEGER, DECIMAL, BOOLEAN, DATE, DATETIME), NULLIF, COALESCE |
| 40 | +- **Aggregate (5):** COUNT (including `COUNT(*)`), SUM, AVG, MIN, MAX |
| 41 | + |
| 42 | +### Window Functions |
| 43 | +- **Ranking:** ROW_NUMBER, RANK, DENSE_RANK, NTILE |
| 44 | +- **Offset:** LAG, LEAD (with optional offset argument) |
| 45 | +- **Aggregate windows:** SUM, AVG, COUNT, MIN, MAX usable with `OVER` |
| 46 | +- **OVER clause** with `PARTITION BY` and/or `ORDER BY` (full-partition scope — window frames not yet supported) |
| 47 | + |
| 48 | +### Public API |
| 49 | +- `SQL4Json` — static facade: `query()`, `queryAsJsonValue()`, `prepare()`, `engine()` |
| 50 | +- `PreparedQuery` — parse-once-execute-many, thread-safe and immutable |
| 51 | +- `SQL4JsonEngine` — long-lived engine with bound data and optional result cache; thread-safe |
| 52 | +- `SQL4JsonEngineBuilder` — fluent builder supporting both unnamed (`$r`) and named (JOIN) data sources |
| 53 | +- `QueryResultCache` — SPI for custom cache implementations (default LRU provided); non-deterministic queries (e.g. `NOW()`) automatically bypass caching |
| 54 | +- `JsonCodec` — SPI for plugging in external JSON libraries (Jackson, Gson, etc.) |
| 55 | +- `JsonValue` — sealed interface providing a library-native, dependency-free JSON abstraction |
| 56 | + |
| 57 | +### Configuration & Security Defaults |
| 58 | +- `Sql4jsonSettings` — immutable top-level settings record composed of four subsection records; customize any subsection via `Sql4jsonSettings.builder()` |
| 59 | +- **`SecuritySettings`:** `maxLikeWildcards` (soft-ReDoS guard on `LIKE` patterns), `redactErrorDetails` (multi-tenant information-disclosure guard) |
| 60 | +- **`LimitsSettings`:** `maxSqlLength`, `maxSubqueryDepth` (default 16), `maxInListSize`, `maxRowsPerQuery` (enforced at GROUP BY, ORDER BY, WINDOW, JOIN, DISTINCT, and the final pipeline/streaming sink) |
| 61 | +- **`CacheSettings`:** bounded LIKE-pattern cache (`likePatternCacheSize`), optional LRU query-result cache (`queryResultCacheEnabled`, `queryResultCacheSize`), plus a pluggable `QueryResultCache` SPI |
| 62 | +- **`DefaultJsonCodecSettings`:** `maxInputLength`, `maxNestingDepth`, `maxStringLength`, `maxNumberLength`, `maxPropertyNameLength`, `maxArrayElements`, `duplicateKeyPolicy` |
| 63 | +- `DuplicateKeyPolicy` enum — `REJECT` (default), `FIRST_WINS`, `LAST_WINS` — resolves RFC 8259 ambiguity on duplicate object keys |
| 64 | +- Conservative defaults out of the box — protect against denial-of-service and information-disclosure risks in multi-tenant deployments without requiring any configuration |
| 65 | + |
| 66 | +### Type System |
| 67 | +- `JsonValue` sealed interface: object, array, string, number, boolean, null |
| 68 | +- `SqlValue` sealed interface for typed query processing: string, number, boolean, date, datetime, null |
| 69 | +- Sealed exception hierarchy: `SQL4JsonException` → `SQL4JsonParseException` (with line/column), `SQL4JsonExecutionException` |
| 70 | + |
| 71 | +### Build & Infrastructure |
| 72 | +- Java 21+ required (JPMS module with explicit exports) |
| 73 | +- Published to Maven Central (`io.github.mnesimiyilmaz:sql4json`) |
| 74 | +- GitHub Actions CI (formatting check + build + test) |
| 75 | +- Spotless code formatting, CycloneDX SBOM generation |
| 76 | +- OWASP dependency-check plugin |
| 77 | +- Dependabot for automated dependency updates |
| 78 | + |
| 79 | +[1.0.0]: https://github.com/mnesimiyilmaz/sql4json/releases/tag/v1.0.0 |
0 commit comments