-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature] adapt limit for sqlserver (#48214) #48248
[Feature] adapt limit for sqlserver (#48214) #48248
Conversation
Signed-off-by: XinzhuangL <[email protected]>
@@ -51,6 +51,10 @@ static std::string get_jdbc_sql(const Slice jdbc_url, const std::string& table, | |||
const std::vector<std::string>& filters, int64_t limit) { | |||
std::ostringstream oss; | |||
oss << "SELECT"; | |||
if (limit != -1 && jdbc_url.starts_with("jdbc:sqlserver")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think for sqlserver the sql will be select top(xx) xxx from xxx limit xxx;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i set the limit=-1, this code "if (limit != -1) {
if (jdbc_url.starts_with("jdbc:oracle")) {
// oracle doesn't support limit clause, we should generate a subquery to do this
// ref: https://stackoverflow.com/questions/470542/how-do-i-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering
return fmt::format("SELECT * FROM ({}) WHERE ROWNUM <= {}", oss.str(), limit);
} else {
oss << " LIMIT " << limit;
}
}" is no longer valid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, got it.
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]❌ fail : 1 / 3 (33.33%) file detail
|
https://github.com/Mergifyio backport branch-3.3 |
✅ Backports have been created
|
Co-authored-by: fl4me <[email protected]>
Why I'm doing:
What I'm doing:
Fixes #48214
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: