Skip to content

Commit 81ccfa6

Browse files
committed
Merge branch 'master' into json_table_support
# Conflicts: # src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
2 parents cb1654a + be39a92 commit 81ccfa6

File tree

119 files changed

+10466
-3005
lines changed

Some content is hidden

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

119 files changed

+10466
-3005
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
run: sudo apt-get install -y xsltproc sphinx-common
8888

8989
- name: Install Python dependencies
90-
run: pip install furo myst_parser sphinx_substitution_extensions sphinx_issues sphinx_inline_tabs pygments
90+
run: pip install manticore_sphinx_theme myst_parser sphinx_substitution_extensions sphinx_issues sphinx_inline_tabs pygments
9191

9292
- name: Build Sphinx documentation with Gradle
9393
run: FLOATING_TOC=false ./gradlew -DFLOATING_TOC=false gitChangelogTask renderRR xslt xmldoc sphinx

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![CI](https://github.com/JSQLParser/JSqlParser/actions/workflows/ci.yml/badge.svg)](https://github.com/JSQLParser/JSqlParser/actions/workflows/ci.yml)
44
[![Coverage Status](https://coveralls.io/repos/JSQLParser/JSqlParser/badge.svg?branch=master)](https://coveralls.io/r/JSQLParser/JSqlParser?branch=master)
55
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6f9a2d7eb98f45969749e101322634a1)](https://www.codacy.com/gh/JSQLParser/JSqlParser/dashboard?utm_source=github.com&utm_medium=referral&utm_content=JSQLParser/JSqlParser&utm_campaign=Badge_Grade)
6-
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.jsqlparser/jsqlparser/badge.svg)](http://maven-badges.herokuapp.com/maven-central/com.github.jsqlparser/jsqlparser) [![Javadocs](https://www.javadoc.io/badge/com.github.jsqlparser/jsqlparser.svg)](https://www.javadoc.io/doc/com.github.jsqlparser/jsqlparser)
6+
[![Maven Central](https://img.shields.io/maven-central/v/com.github.jsqlparser/jsqlparser.svg?label=maven-central)](https://central.sonatype.com/artifact/com.github.jsqlparser/jsqlparser) [![Javadocs](https://www.javadoc.io/badge/com.github.jsqlparser/jsqlparser.svg)](https://www.javadoc.io/doc/com.github.jsqlparser/jsqlparser)
77
[![Gitter](https://badges.gitter.im/JSQLParser/JSqlParser.svg)](https://gitter.im/JSQLParser/JSqlParser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
88

99
A huge thank you to our sponsor, [Starlake.ai](https://starlake.ai/) who simplifies data ingestion, transformation, and orchestration, enabling faster delivery of high-quality data. Starlake has been instrumental in providing Piped SQL and numerous test cases for BigQuery, Redshift, DataBricks, and DuckDB. Show your support for ongoing development by visiting Starlake.ai and giving us a star!
@@ -76,9 +76,11 @@ JSQLParser-5.4 Snapshot and later use JavaCC-8 Snapshots for generating the pars
7676
Unfortunately the released JSQLParser-5.2 shows a performance deterioration caused by commit [30cf5d7](https://github.com/JSQLParser/JSqlParser/commit/30cf5d7b930ae0a076f49deb5cc841d39e62b3dc) related to `FunctionAllColumns()`.
7777
This has been resolved in JSQLParser 5.3-SNAPSHOT and JMH benchmarks have been added to avoid such regressions in the future. Further all `LOOKAHEAD` have been revised one by one, and we have gained back a very good performance of the Parser.
7878

79+
As per March-2026, the productions `Condition()`, `RegularCondition()` and `AndExpression()` have been refactored successfully. This resulted in a massive performance boost and seem to have solved most of the performance issues.
80+
7981
```text
8082
Benchmark (version) Mode Cnt Score Error Units
81-
JSQLParserBenchmark.parseSQLStatements latest avgt 15 82.695 ± 2.841 ms/op
83+
JSQLParserBenchmark.parseSQLStatements latest avgt 15 15.908 ± 0.446 ms/op <-- March/26
8284
JSQLParserBenchmark.parseSQLStatements 5.3 avgt 15 84.687 ± 3.321 ms/op
8385
JSQLParserBenchmark.parseSQLStatements 5.1 avgt 15 86.592 ± 5.781 ms/op
8486
```
@@ -105,7 +107,6 @@ If you like JSqlParser then please check out its related projects:
105107
* [JSQLTranspiler](https://manticore-projects.com/JSQLTranspiler/index.html) for dialect specific rewriting, SQL Column resolution and Lineage, provided by [Starlake.ai](https://starlake.ai/)
106108

107109
## Alternatives to JSqlParser?
108-
[**General SQL Parser**](http://www.sqlparser.com/features/introduce.php?utm_source=github-jsqlparser&utm_medium=text-general) looks pretty good, with extended SQL syntax (like PL/SQL and T-SQL) and java + .NET APIs. The tool is commercial (license available online), with a free download option.
109110

110111
Alternatively the dual-licensed [JOOQ](https://www.jooq.org/doc/latest/manual/sql-building/sql-parser/) provides a handwritten Parser supporting a lot of RDBMS, translation between dialects, SQL transformation, can be used as a JDBC proxy for translation and transformation purposes.
111112

build.gradle

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ tasks.register('generateBuildInfo') {
9191
def buildTime = Instant.now().toString()
9292

9393
def content = """\
94-
|package ai.starlake.jsqltranspiler;
94+
|package net.sf.jsqlparser;
9595
|
9696
|public final class BuildInfo {
9797
| public static final String NAME = "${project.name}";
@@ -154,6 +154,7 @@ dependencies {
154154
testImplementation 'com.h2database:h2:+'
155155

156156
// for JaCoCo Reports
157+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.4'
157158
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
158159
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
159160
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.4'
@@ -221,18 +222,18 @@ javadoc {
221222
jar {
222223
manifest {
223224
attributes (
224-
"Automatic-Module-Name": "net.sf.jsqlparser"
225+
"Automatic-Module-Name": "net.sf.jsqlparser"
225226
)
226227
}
227228

228229
bundle {
229230
properties.empty()
230231
bnd(
231-
"Created-By": System.properties.get('user.name'),
232-
"Bundle-SymbolicName": "net.sf.jsqlparser",
233-
"Import-Package": "*",
234-
"Export-Package": "net.sf.jsqlparser.*",
235-
"Automatic-Module-Name": "net.sf.jsqlparser"
232+
"Created-By": System.properties.get('user.name'),
233+
"Bundle-SymbolicName": "net.sf.jsqlparser",
234+
"Import-Package": "*",
235+
"Export-Package": "net.sf.jsqlparser.*",
236+
"Automatic-Module-Name": "net.sf.jsqlparser"
236237
)
237238
}
238239

@@ -343,7 +344,7 @@ jacocoTestCoverageVerification {
343344

344345
//@todo: temporarily increased to 7000, we need to bring that down to 5500 after accepting the Keywords PR
345346
maximum = 20000
346-
}
347+
}
347348
excludes = [
348349
'net.sf.jsqlparser.util.validation.*',
349350
'net.sf.jsqlparser.**.*Adapter',
@@ -378,27 +379,31 @@ spotbugsMain {
378379
spotbugs {
379380
// fail only on P1 and without the net.sf.jsqlparser.parser.*
380381
excludeFilter = file("config/spotbugs/spotBugsExcludeFilter.xml")
382+
}
381383

382-
// do not run over the test, although we should do that eventually
383-
spotbugsTest.enabled = false
384+
// do not run over the test, although we should do that eventually
385+
tasks.named('spotbugsTest').configure {
386+
enabled = false
384387
}
385388

386389
pmd {
390+
// later versions throw NPE
391+
toolVersion = '7.17.0'
392+
387393
consoleOutput = true
388394
sourceSets = [sourceSets.main]
389395

390396
// clear the ruleset in order to use configured rules only
391397
ruleSets = []
392-
393-
//rulesMinimumPriority = 1
398+
rulesMinimumPriority = 2
394399
ruleSetFiles = files("config/pmd/ruleset.xml")
400+
}
395401

396-
pmdMain {
397-
excludes = [
398-
"build/generated/*"
399-
, "**/net/sf/jsqlparser/parser/SimpleCharStream.java"
400-
]
401-
}
402+
tasks.named('pmdMain').configure {
403+
excludes = [
404+
"build/generated/*"
405+
, "**/net/sf/jsqlparser/parser/SimpleCharStream.java"
406+
]
402407
}
403408

404409
checkstyle {
@@ -461,28 +466,34 @@ tasks.register('renderRR') {
461466
}
462467

463468
// Convert JJ file to EBNF
464-
tasks.register("convertJJ", JavaExec) {
465-
standardOutput = new FileOutputStream(new File(rrDir, "JSqlParserCC.ebnf"))
466-
mainClass = "-jar"
467-
args = [
468-
new File(rrDir, "convert.war").absolutePath,
469-
layout.buildDirectory.dir("generated/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jj").get().asFile.absolutePath
470-
]
471-
}.get().exec()
469+
def ebnfFile = new File(rrDir, "JSqlParserCC.ebnf")
470+
def jjFile = layout.buildDirectory.dir("generated/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jj").get().asFile.absolutePath
471+
472+
def convertProc = new ProcessBuilder('java', '-jar',
473+
new File(rrDir, "convert.war").absolutePath,
474+
jjFile)
475+
.redirectOutput(ebnfFile)
476+
.redirectErrorStream(true)
477+
.start()
478+
if (convertProc.waitFor() != 0) {
479+
throw new GradleException("Failed to convert JJ to EBNF")
480+
}
472481

473482
// Generate RR diagrams
474-
tasks.register("generateRR", JavaExec) {
475-
mainClass = "-jar"
476-
args = [
477-
new File(rrDir, "rr.war").absolutePath,
478-
"-noepsilon",
479-
"-color:#4D88FF",
480-
"-offset:0",
481-
"-width:800",
482-
"-out:${new File(rrDir, "JSqlParserCC.xhtml")}",
483-
new File(rrDir, "JSqlParserCC.ebnf").absolutePath
484-
]
485-
}.get().exec()
483+
def rrProc = new ProcessBuilder('java', '-jar',
484+
new File(rrDir, "rr.war").absolutePath,
485+
"-noepsilon",
486+
"-color:#4D88FF",
487+
"-offset:0",
488+
"-width:800",
489+
"-out:${new File(rrDir, "JSqlParserCC.xhtml")}",
490+
new File(rrDir, "JSqlParserCC.ebnf").absolutePath)
491+
.redirectErrorStream(true)
492+
.start()
493+
rrProc.inputStream.eachLine { logger.info(it) }
494+
if (rrProc.waitFor() != 0) {
495+
throw new GradleException("Failed to generate RR diagrams")
496+
}
486497
}
487498
}
488499

@@ -528,13 +539,13 @@ Version {{name}}
528539

529540
tasks.register('updateKeywords', JavaExec) {
530541
group = "Execution"
531-
description = "Run the main class with JavaExecTask"
542+
description = "Generate the Reserved Keywords documentation"
532543
classpath = sourceSets.main.runtimeClasspath
533544
args = [
534545
file('src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt').absolutePath
535546
, file('src/site/sphinx/keywords.rst').absolutePath
536547
]
537-
main("net.sf.jsqlparser.parser.ParserKeywordsUtils")
548+
mainClass.set("net.sf.jsqlparser.parser.ParserKeywordsUtils")
538549

539550
dependsOn(compileJava)
540551
}
@@ -548,7 +559,7 @@ tasks.register('xslt', SaxonXsltTask) {
548559
stylesheet file('src/main/resources/rr/xhtml2rst.xsl')
549560

550561
parameters(
551-
"withFloatingToc": System.getProperty("FLOATING_TOC", "true"),
562+
"withFloatingToc": System.getProperty("FLOATING_TOC", "false"),
552563
"isSnapshot": Boolean.toString(version.endsWith("-SNAPSHOT"))
553564
)
554565

@@ -732,4 +743,4 @@ jmh {
732743
fork = 3
733744
iterations = 5
734745
timeOnIteration = '1s'
735-
}
746+
}

config/pmd/ruleset.xml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ under the License.
2020
<ruleset name="Default Maven PMD Plugin Ruleset" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
2121

2222
<description>
23-
The default ruleset used by the Maven PMD Plugin, when no other ruleset is specified.
24-
It contains the rules of the old (pre PMD 6.0.0) rulesets java-basic, java-empty, java-imports,
25-
java-unnecessary, java-unusedcode.
23+
Custom PMD ruleset, compatible with PMD 7.x.
2624

27-
This ruleset might be used as a starting point for an own customized ruleset [0].
25+
Based on the old (pre PMD 6.0.0) rulesets java-basic, java-empty, java-imports,
26+
java-unnecessary, java-unusedcode, migrated for PMD 7.
2827

29-
[0] https://pmd.github.io/latest/pmd_userdocs_making_rulesets.html
30-
</description>
28+
This ruleset might be used as a starting point for an own customized ruleset [0].
29+
30+
[0] https://pmd.github.io/latest/pmd_userdocs_making_rulesets.html
31+
</description>
3132

3233
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
3334
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
@@ -46,6 +47,14 @@ under the License.
4647
<rule ref="category/java/codestyle.xml/UselessParentheses" />
4748
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
4849

50+
<!-- PMD 7: replaces EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer,
51+
EmptyStatementBlock, EmptySwitchStatements, EmptySynchronizedBlock,
52+
EmptyTryBlock, EmptyWhileStmt (all removed in PMD 7) -->
53+
<rule ref="category/java/codestyle.xml/EmptyControlStatement" />
54+
55+
<!-- PMD 7: replaces EmptyStatementNotInLoop (removed in PMD 7) -->
56+
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />
57+
4958
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
5059
<properties>
5160
<property name="methodPattern" value="[a-z][a-zA-Z0-9]*" />
@@ -63,14 +72,15 @@ under the License.
6372
<rule ref="category/java/design.xml/UselessOverridingMethod" />
6473
<rule ref="category/java/design.xml/AvoidThrowingNullPointerException" />
6574

66-
6775
<rule ref="category/java/design.xml/CyclomaticComplexity">
6876
<properties>
6977
<property name="classReportLevel" value="200" />
7078
<property name="methodReportLevel" value="120" />
7179
</properties>
7280
</rule>
73-
<rule ref="category/java/design.xml/ExcessiveMethodLength" />
81+
82+
<!-- PMD 7: ExcessiveMethodLength was removed, use NcssCount instead -->
83+
<rule ref="category/java/design.xml/NcssCount" />
7484

7585
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
7686
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
@@ -80,32 +90,25 @@ under the License.
8090
<rule ref="category/java/errorprone.xml/CheckSkipResult" />
8191
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
8292
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
93+
94+
<!-- EmptyCatchBlock is explicitly kept as a separate rule in PMD 7 -->
8395
<rule ref="category/java/errorprone.xml/EmptyCatchBlock" />
84-
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock" />
85-
<rule ref="category/java/errorprone.xml/EmptyIfStmt" />
86-
<rule ref="category/java/errorprone.xml/EmptyInitializer" />
87-
<rule ref="category/java/errorprone.xml/EmptyStatementBlock" />
88-
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop" />
89-
<rule ref="category/java/errorprone.xml/EmptySwitchStatements" />
90-
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock" />
91-
<rule ref="category/java/errorprone.xml/EmptyTryBlock" />
92-
<rule ref="category/java/errorprone.xml/EmptyWhileStmt" />
96+
9397
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
9498
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
9599
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
96100
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
97101
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
98102
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" />
99103
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" />
100-
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" />
101-
102-
<!-- for Codazy -->
104+
105+
<!-- for Codazy -->
103106
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
104107
<rule ref="category/java/multithreading.xml/DontCallThreadRun" />
105108
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
106109

107110
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
108111

109-
<!-- for Codazy -->
112+
<!-- for Codazy -->
110113
<!-- <rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody" /> -->
111-
</ruleset>
114+
</ruleset>

gradle/wrapper/gradle-wrapper.jar

5.26 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)