Skip to content

Fixes #1381#1383

Merged
wumpz merged 3 commits intoJSQLParser:masterfrom
manticore-projects:Issue1381
Nov 19, 2021
Merged

Fixes #1381#1383
wumpz merged 3 commits intoJSQLParser:masterfrom
manticore-projects:Issue1381

Conversation

@manticore-projects
Copy link
Contributor

@manticore-projects manticore-projects commented Oct 19, 2021

Allow Complex Expressions as SelectItem
Fixes #1381

SELECT ( 1 = 1 ) AND ( 1 = 2 )

Fixes #602

Allow Complex Expressions as SelectItem
{
expression=Condition() { selectExpressionItem = new SelectExpressionItem(); selectExpressionItem.setExpression(expression); }
[alias=Alias() { selectExpressionItem.setAlias(alias); }] { return selectExpressionItem; }
expression=Expression() { selectExpressionItem = new SelectExpressionItem(); selectExpressionItem.setExpression(expression); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this impact the performance of JSqlParser? It is a drastic change in the complexety the parser has to deal with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It certainly runs a bit slower e. g. the full test suite takes now around 26 seconds instead of 22 seconds before.
However, this is a very unscientific way to measure and most importantly: everything runs through and is correct. Also I am still able to use the near time parsing in the Online JSQLFormatter Instance (highlighting errors while I type.)

In my book, while we strive for performance, correctness always beats execution speed.
If you want to write the fastest possible (but incorrect) parser, then this would also be the smallest possible grammar: just throw an exception on everything :-D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange argument, since this parser will never be in that sense correct. However, resolve conflicts and I will merge.

# Conflicts:
#	src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java
# Conflicts:
#	src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java
@wumpz wumpz merged commit cdf0f09 into JSQLParser:master Nov 19, 2021
@manticore-projects manticore-projects deleted the Issue1381 branch May 31, 2022 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql can not be parse OR not parsed correctly

2 participants