JSqlParser
JSqlParser copied to clipboard
replace all uses of expression with simpleexpression where it fits
Expression does allow all kinds of complex boolean relations like a = 5 and b = 6 which is for most cases not suitable.
This will increase parsing speed of those productions by a huge margin.
Greetings.
Unfortunately I do not understand what you intend to do: Did we not replace a few SimpleExpression with Expression exactly for parsing complex expressions?
Thats right, but not in every case that is needed. But in doing so, the parsing is much more complex.
For instance your latest change of LikeExpression. Why should the escape expression be indeed this kind of complex expression?
And I do not want to replace all / or a few SimpleExpressions with Expression to parse in every occasion complex expressions. At least not when this has such a performance impact. I know your argument of being complete, but not at the lately discovered costs.
Maybe this should be optional? The class itself could hold an Expression but if a complex expression is parsed, could be switched on / off.
Greetings.
We actually DO have such a FEATURE already: AllowComplexExpressionParsing, which is set to TRUE most times, but only set to FALSE when we detect too deep nesting.
You can set this FEATURE manually though when calling the parser:
CCJSqlParser parser = newParser(sql).withAllowComplexParsing(false);
If you insist in SimpleExpression on demand, then just modify the LOOKAHEADs like
LOOKAHEAD( {getAsBoolean(Feature.allowComplexParsing)} ) expression = Expression() | expression = SimpleExpression()
We could implement two methods parse() and fastParse() and set AllowComplexExpressionParsing to FALSE for the later one.
I was not aware that this AllowComplexExpressionParsing is a global option. I thought it was only checked for CaseWhenExpressions.
Am I wrong?
We use it at various places. Most prominently in Primary Expression and Case.Sent from my Galaxy -------- Original message --------From: Tobias @.> Date: 12/12/2021 15:34 (GMT+01:00) To: JSQLParser/JSqlParser @.> Cc: manticore-projects @.>, Comment @.> Subject: Re: [JSQLParser/JSqlParser] replace all uses of expression with simpleexpression where it fits (Issue #1424) I was not aware that this AllowComplexExpressionParsing is a global option. I thought it was only checked for CaseWhenExpressions. Am I wrong?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
Closed, since no further question has been asked.