Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes coalesce and case operators in multithreaded environments with different number of arguments #2259

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

igormukhin
Copy link
Contributor

@igormukhin igormukhin commented Sep 11, 2024

The bug is described in the issue #2136. The bug was in the 2.7 version, and it was somewhat fixed in later versions but still failed when statements had different number of parameters.

TestArgumentListFunctionExpressionConcurrency.java - adds tests that reproduce the bug.
ExpressionOperator.java - fixes getArgumentIndices by disabling the caching of the dynamically created argument indexes.

…different number of arguments

The bug is described in the issue eclipse-ee4j#2136

TestArgumentListFunctionExpressionConcurrency.java - adds tests that reproduce the bug.
ArgumentListFunctionExpression.java - fixes printSQL to use the operator itself and not the common instance of it
@lukasj lukasj self-requested a review September 11, 2024 13:47
@@ -97,11 +97,10 @@ public void setOperator(ExpressionOperator theOperator) {
*/
@Override
public void printSQL(ExpressionSQLPrinter printer) {
ListExpressionOperator realOperator;
realOperator = (ListExpressionOperator)getPlatformOperator(printer.getPlatform());
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry but this removal is problematic as there should be some differences between DB platforms.
Try e.g. mvn clean verify -pl :org.eclipse.persistence.jpa.jse.test -P derby against before modification and after to see what happens. -P derby means that Implicit Apache Derby DB is used (it is managed started/stopped by EclipseLink Maven build scripts).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I see what you mean.
In that case the problem is that getPlatformOperator() returns the same cached instance of the operator on each call which leads to errors with the operators with variable number of arguments like "coalesce" and "case when".
I think I have a solution in mind. I will push it later.

@igormukhin igormukhin marked this pull request as draft September 11, 2024 14:56
…different number of arguments

The bug is described in the issue eclipse-ee4j#2136

TestArgumentListFunctionExpressionConcurrency.java - adds tests that reproduce the bug.
ExpressionOperator.java - fixes getArgumentIndices by disabling the caching of the dynamically created argument indexes.
@igormukhin igormukhin marked this pull request as ready for review September 11, 2024 15:16
Copy link
Contributor

@rfelcman rfelcman left a comment

Choose a reason for hiding this comment

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

LGTM

@rfelcman rfelcman merged commit 4a7149f into eclipse-ee4j:master Sep 12, 2024
6 checks passed
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.

4 participants