File tree Expand file tree Collapse file tree 7 files changed +65
-3
lines changed
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement/select Expand file tree Collapse file tree 7 files changed +65
-3
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ Also I would like to know about needed examples or documentation stuff.
56
56
57
57
## Extensions in the latest SNAPSHOT version 4.3
58
58
59
+ * moved to JUnit 5 as a test framework
60
+ * added ** IGNORE NULLS** to window functions
61
+
59
62
Additionally, we have fixed many errors and improved the code quality and the test coverage.
60
63
61
64
## Extensions of JSqlParser releases
Original file line number Diff line number Diff line change @@ -19,9 +19,13 @@ java.sourceCompatibility = JavaVersion.VERSION_1_8
19
19
repositories {
20
20
gradlePluginPortal()
21
21
mavenLocal()
22
+ mavenCentral()
22
23
maven {
23
24
url = uri(' https://repo.maven.apache.org/maven2/' )
24
25
}
26
+ maven {
27
+ url " https://plugins.gradle.org/m2/"
28
+ }
25
29
}
26
30
27
31
dependencies {
@@ -36,6 +40,12 @@ dependencies {
36
40
testImplementation ' org.junit.jupiter:junit-jupiter-api:5.7.1'
37
41
testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine'
38
42
43
+ // https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
44
+ testImplementation ' org.mockito:mockito-junit-jupiter:4.1.0'
45
+
46
+ // enforce latest version of JavaCC
47
+ javacc ' net.java.dev.javacc:javacc:7.0.10'
48
+
39
49
}
40
50
41
51
compileJavacc {
@@ -56,6 +66,18 @@ jacoco {
56
66
}
57
67
58
68
test {
69
+ useJUnitPlatform()
70
+
71
+ // set heap size for the test JVM(s)
72
+ minHeapSize = " 128m"
73
+ maxHeapSize = " 1G"
74
+
75
+ jvmArgs << [
76
+ ' -Djunit.jupiter.execution.parallel.enabled=true' ,
77
+ ' -Djunit.jupiter.execution.parallel.config.strategy=dynamic' ,
78
+ ' -Djunit.jupiter.execution.parallel.mode.default=concurrent'
79
+ ]
80
+
59
81
finalizedBy jacocoTestReport // report is always generated after tests run
60
82
finalizedBy jacocoTestCoverageVerification
61
83
}
@@ -93,7 +115,7 @@ jacocoTestCoverageVerification {
93
115
limit {
94
116
counter = ' LINE'
95
117
value = ' MISSEDCOUNT'
96
- maximum = 5458
118
+ maximum = 5500
97
119
}
98
120
excludes = [
99
121
' net.sf.jsqlparser.util.validation.*' ,
Original file line number Diff line number Diff line change
1
+ # Specifies the JVM arguments used for the daemon process.
2
+ # The setting is particularly useful for tweaking memory settings.
3
+ org.gradle.jvmargs =-Xmx1G -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError
4
+
5
+ org.gradle.caching =true
6
+
7
+ # Modularise your project and enable parallel build
8
+ org.gradle.parallel =true
9
+
10
+ # Enable configure on demand.
11
+ org.gradle.configureondemand =true
12
+
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ public class AnalyticExpression extends ASTNodeAccessImpl implements Expression
36
36
private AnalyticType type = AnalyticType .OVER ;
37
37
private boolean distinct = false ;
38
38
private boolean unique = false ;
39
- private boolean ignoreNulls = false ;
39
+ private boolean ignoreNulls = false ; //IGNORE NULLS inside function parameters
40
+ private boolean ignoreNullsOutside = false ; //IGNORE NULLS outside function parameters
40
41
private Expression filterExpression = null ;
41
42
private WindowElement windowElement = null ;
42
43
private List <OrderByElement > funcOrderBy = null ;
@@ -178,6 +179,14 @@ public void setIgnoreNulls(boolean ignoreNulls) {
178
179
this .ignoreNulls = ignoreNulls ;
179
180
}
180
181
182
+ public boolean isIgnoreNullsOutside () {
183
+ return ignoreNullsOutside ;
184
+ }
185
+
186
+ public void setIgnoreNullsOutside (boolean ignoreNullsOutside ) {
187
+ this .ignoreNullsOutside = ignoreNullsOutside ;
188
+ }
189
+
181
190
@ Override
182
191
@ SuppressWarnings ({"PMD.CyclomaticComplexity" , "PMD.NPathComplexity" , "PMD.MissingBreakInSwitch" })
183
192
public String toString () {
@@ -220,6 +229,10 @@ public String toString() {
220
229
}
221
230
}
222
231
232
+ if (isIgnoreNullsOutside ()) {
233
+ b .append ("IGNORE NULLS " );
234
+ }
235
+
223
236
switch (type ) {
224
237
case FILTER_ONLY :
225
238
return b .toString ();
Original file line number Diff line number Diff line change @@ -674,6 +674,10 @@ public void visit(AnalyticExpression aexpr) {
674
674
buffer .append (" " );
675
675
}
676
676
}
677
+
678
+ if (aexpr .isIgnoreNullsOutside ()) {
679
+ buffer .append ("IGNORE NULLS " );
680
+ }
677
681
678
682
switch (aexpr .getType ()) {
679
683
case FILTER_ONLY :
Original file line number Diff line number Diff line change @@ -4184,7 +4184,7 @@ void windowFun(AnalyticExpression retval):{
4184
4184
WindowElement windowElement = null;
4185
4185
boolean partitionByBrackets = false;
4186
4186
} {
4187
- (<K_OVER> {retval.setType(AnalyticType.OVER);}
4187
+ ([<K_IGNORE> <K_NULLS> { retval.setIgnoreNullsOutside(true); } ] <K_OVER> {retval.setType(AnalyticType.OVER);}
4188
4188
| <K_WITHIN> <K_GROUP> {retval.setType(AnalyticType.WITHIN_GROUP);} )
4189
4189
4190
4190
"("
Original file line number Diff line number Diff line change 45
45
import static org .junit .jupiter .api .Assertions .fail ;
46
46
import org .junit .jupiter .api .Disabled ;
47
47
import org .junit .jupiter .api .Test ;
48
+ import org .junit .jupiter .api .parallel .Execution ;
49
+ import org .junit .jupiter .api .parallel .ExecutionMode ;
48
50
51
+ @ Execution (ExecutionMode .CONCURRENT )
49
52
public class SelectTest {
50
53
51
54
private final CCJSqlParserManager parserManager = new CCJSqlParserManager ();
@@ -4972,4 +4975,9 @@ public void testLogicalExpressionSelectItemIssue1381() throws JSQLParserExceptio
4972
4975
public void testKeywordAtIssue1414 () throws JSQLParserException {
4973
4976
assertSqlCanBeParsedAndDeparsed ("SELECT * FROM table1 at" );
4974
4977
}
4978
+
4979
+ @ Test
4980
+ public void testIgnoreNullsForWindowFunctionsIssue1429 () throws JSQLParserException {
4981
+ assertSqlCanBeParsedAndDeparsed ("SELECT lag(mydata) IGNORE NULLS OVER (ORDER BY sortorder) AS previous_status FROM mytable" );
4982
+ }
4975
4983
}
You can’t perform that action at this time.
0 commit comments