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
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
if (paginationValueSegment instanceof ExpressionRowNumberValueSegment) {
return ((ExpressionRowNumberValueSegment) paginationValueSegment).getValue(params);
Expand Down
Loading