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

Fix issue:Add field type judgment in PaginationContext #34332

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

strawberry1314
Copy link
Contributor

Fixes #34289.
Add type judgment for the limit parameter

Changes proposed in this pull request:


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

raojf added 4 commits January 9, 2025 14:07
…rameters is greater than the number of inserted fields
# Conflicts:
#	proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java
@@ -58,7 +58,7 @@ private Long getValue(final PaginationValueSegment paginationValueSegment, final
if (null == obj) {
return null;
}
return obj instanceof Long ? (long) obj : (int) obj;
return obj instanceof byte[] ? (long) (((byte[]) obj)[0] - '0') : obj instanceof Long ? (long) obj : (int) obj;
Copy link
Member

Choose a reason for hiding this comment

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

Why is the LIMIT parameter a byte[]? Is this a special treatment of the MySQL protocol for the Go language?

Copy link
Member

Choose a reason for hiding this comment

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

If possible, please add an E2E SQL that can reproduce this exception. You can add a new case in https://github.com/apache/shardingsphere/blob/master/test/e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not particularly clear about the processing method of the Go language, I just found that the LIMIT parameter will be resolved to byte[] when I use Golang to execute prepare sql.
such as : SELECT order_id FROM t_order LIMIT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If possible, please add an E2E SQL that can reproduce this exception. You can add a new case in https://github.com/apache/shardingsphere/blob/master/test/e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml.

I have already added an E2E SQL case

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.

Class MySQLComStmtExecuteExecutor throws a NullPointerException when select with limit by Golang
2 participants