Skip to content

Commit 7692e23

Browse files
committed
Release v1.0.0
1 parent 1808987 commit 7692e23

211 files changed

Lines changed: 29937 additions & 3737 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claudeignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Build output
2+
target/
3+
.git/
4+
.vscode/
5+
6+
# IDE files
7+
.idea/
8+
*.iml
9+
.vscode/
10+
.settings/
11+
.project
12+
.classpath
13+
14+
# OS files
15+
.DS_Store
16+
Thumbs.db

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Normalize EOL for all files that Git considers text files.
2+
* text=auto eol=lf

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
open-pull-requests-limit: 5

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up JDK 21
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '21'
23+
distribution: 'temurin'
24+
cache: maven
25+
26+
- name: Check formatting
27+
run: ./mvnw spotless:check
28+
29+
- name: Build and test
30+
run: ./mvnw clean verify

.github/workflows/javadoc.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Javadoc
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up JDK 21
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '21'
26+
distribution: 'temurin'
27+
cache: maven
28+
29+
- name: Generate Javadoc
30+
run: ./mvnw javadoc:javadoc -q
31+
32+
- name: Upload Pages artifact
33+
uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: target/site/apidocs
36+
37+
deploy:
38+
needs: build
39+
runs-on: ubuntu-latest
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deployment.outputs.page_url }}
43+
steps:
44+
- name: Deploy to GitHub Pages
45+
id: deployment
46+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ build/
2323
!**/src/main/**/build/
2424
!**/src/test/**/build/
2525
.vscode/
26-
.DS_Store
26+
.DS_Store
27+
.worktrees/
28+
/src/test/resources/data-files/*.json
29+
.claude
30+
.mvn/wrapper/maven-wrapper.jar
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.14/apache-maven-3.9.14-bin.zip

CHANGELOG.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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

Comments
 (0)