René's URL Explorer Experiment


Title: fix(sql): count groups for HEAD requests with @group by lnuxe · Pull Request #884 · APIJSON/APIJSON · GitHub

Open Graph Title: fix(sql): count groups for HEAD requests with @group by lnuxe · Pull Request #884 · APIJSON/APIJSON

X Title: fix(sql): count groups for HEAD requests with @group by lnuxe · Pull Request #884 · APIJSON/APIJSON

Description: 背景 issue #624 反馈:[] 里带 @group 时,total 拿到的是组内数量而不是分组后的总条数。 复现请求(issue 里的原始 JSON): { "[]": { "VehicleList_count": { "vehicleid$": "鄂QD24S8_0%", "sumdate%": "2023-10-15,2023-10-17", "@group": "vehicleid,sumdate", "@column": "vehicleid;sumdate;max(cnt):maxcnt", "@order": "maxcnt-" }, "page": 0, "count": 5 }, "total@": "/[]/total" } 原因 gainColumnString 在 HEAD 请求下把 SELECT 换成 count(*),但 gainConditionString 对 HEAD 仍然拼接 GROUP BY,于是生成: SELECT count(*) AS `count` FROM `sys`.`Vehicle` GROUP BY `vid`,`sdate` 这条 SQL 返回的是每一组的行数(多行),不是分组后的组数,所以 total 语义错位。Oracle 分支(isOracle() || isDameng() || isKingBaseOracle())早就用外层 count(*) 包了一层子查询,其它库没有对应处理。 修复 在 gainSelectSQL 里对齐 Oracle 的写法:@group 非空且是 HEAD 方法时,把原语句包成子查询再 count(*): if (StringUtil.isNotEmpty(getGroup(), true) && RequestMethod.isHeadMethod(getMethod(), true)) { String sql = "SELECT " + (getCache() == JSONMap.CACHE_RAM ? "SQL_NO_CACHE " : "") + column + " FROM " + gainConditionString(tablePath, this); return explain + "SELECT count(*)" + gainAs() + getQuote() + JSONResponse.KEY_COUNT + getQuote() + " FROM (" + sql + ")" + gainAs() + gainSQLAliasWithQuote(); } MySQL / SQL Server 要求 FROM 子查询有别名,用已有的 gainSQLAliasWithQuote() 补上,各库引号风格自动适配。 修复后: -- MySQL SELECT count(*) AS `count` FROM (SELECT count(*) AS `count` FROM `sys`.`Vehicle` GROUP BY `vid`,`sdate`) AS `Vehicle` -- PostgreSQL SELECT count(*) AS "count" FROM (SELECT count(*) AS "count" FROM "sys"."Vehicle" GROUP BY "vid","sdate") AS "Vehicle" 测试 新增 AbstractSQLConfigGroupCountTest,覆盖: MySQL / PostgreSQL / SQL Server / DB2 分组 HEAD 都断言外层 count(*) + 子查询结构,且外层不再出现 GROUP BY 没有 @group 时保持原来的单层 count(*),不包子查询 GET + @group 保持原样,不被改成 count(*) 双通道验证 修复前(git checkout 还原 AbstractSQLConfig.java): [ERROR] AbstractSQLConfigGroupCountTest.countsGroupsInsteadOfRowsInEachGroupForMySQL:87 HEAD with @group on MYSQL: SELECT count(*) AS `count` FROM `sys`.`Vehicle` GROUP BY `vid`,`sdate` [ERROR] Tests run: 6, Failures: 4, Errors: 0, Skipped: 0 修复后: [INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 -- in apijson.orm.AbstractSQLConfigGroupCountTest [INFO] Tests run: 44, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS 全量 mvn test 44 个用例全绿(原有 38 + 新增 6),无回归。 fix #624

Open Graph Description: 背景 issue #624 反馈:[] 里带 @group 时,total 拿到的是组内数量而不是分组后的总条数。 复现请求(issue 里的原始 JSON): { "[]": { "VehicleList_count": { "vehicleid$": "鄂QD24S8_0%", ...

X Description: 背景 issue #624 反馈:[] 里带 @group 时,total 拿到的是组内数量而不是分组后的总条数。 复现请求(issue 里的原始 JSON): { "[]": { "VehicleList_count": { "vehicleid$": &am...

Opengraph URL: https://github.com/APIJSON/APIJSON/pull/884

X: @github

direct link

Domain: redirect.github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:022d5917-ae15-44e9-3ede-a7c4c6628c16
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB06E:37EB8F:A7784F:EEE099:6AFCB8D0
html-safe-noncebc391b5d03284f08ae7c64f8ea17d15ce1a3595e6929adb3144e21c166a216af
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDZFOjM3RUI4RjpBNzc4NEY6RUVFMDk5OjZBRkNCOEQwIiwidmlzaXRvcl9pZCI6IjI2NzM3NDY0NzM2MTAxNjQ0MzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb5d4e322e1e49a0094af3514f460775ee4d323aa6d98c410969a70d576461353
hovercard-subject-tagpull_request:5259074163
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/APIJSON/APIJSON/pull/884/files
twitter:imagehttps://avatars.githubusercontent.com/u/144079529?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/144079529?s=400&v=4
og:image:alt背景 issue #624 反馈:[] 里带 @group 时,total 拿到的是组内数量而不是分组后的总条数。 复现请求(issue 里的原始 JSON): { "[]": { "VehicleList_count": { "vehicleid$": "鄂QD24S8_0%", ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee3084aead77cbcb4f4904fba53851fa1a0546b0dec3619bd250815e72588dc6d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/APIJSON/APIJSON git https://github.com/APIJSON/APIJSON.git
octolytics-dimension-user_id41146037
octolytics-dimension-user_loginAPIJSON
octolytics-dimension-repository_id74359442
octolytics-dimension-repository_nwoAPIJSON/APIJSON
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id74359442
octolytics-dimension-repository_network_root_nwoAPIJSON/APIJSON
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5410e4bebd3e45b138c853ecef3992279d86d5af
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/APIJSON/APIJSON/pull/884/files#start-of-content
https://redirect.github.com/
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAPIJSON%2FAPIJSON%2Fpull%2F884%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2FAPIJSON%2FAPIJSON%2Fpull%2F884%2Ffiles
Sign uphttps://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=APIJSON%2FAPIJSON
Reloadhttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
Reloadhttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
Reloadhttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
APIJSONhttps://redirect.github.com/APIJSON
APIJSONhttps://redirect.github.com/APIJSON/APIJSON
Codehttps://redirect.github.com/APIJSON/APIJSON
Issues237 (237)https://redirect.github.com/APIJSON/APIJSON/issues
Pull requestshttps://redirect.github.com/APIJSON/APIJSON/pulls
Actionshttps://redirect.github.com/APIJSON/APIJSON/actions
Wikihttps://redirect.github.com/APIJSON/APIJSON/wiki
Security and qualityhttps://redirect.github.com/APIJSON/APIJSON/security
Insightshttps://redirect.github.com/APIJSON/APIJSON/insights
Sign up for GitHub https://redirect.github.com/signup?return_to=%2FAPIJSON%2FAPIJSON%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://redirect.github.com/login?return_to=%2FAPIJSON%2FAPIJSON%2Fissues%2Fnew%2Fchoose
TommyLemonhttps://redirect.github.com/TommyLemon
APIJSON:mainhttps://redirect.github.com/APIJSON/APIJSON/tree/main
lnuxe:fix-grouped-head-counthttps://redirect.github.com/lnuxe/APIJSON/tree/fix-grouped-head-count
Conversation 0 https://redirect.github.com/APIJSON/APIJSON/pull/884
Commits 1 https://redirect.github.com/APIJSON/APIJSON/pull/884/commits
Checks 1 https://redirect.github.com/APIJSON/APIJSON/pull/884/checks
Files changed https://redirect.github.com/APIJSON/APIJSON/pull/884/files
Please reload this pagehttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
fix(sql): count groups for HEAD requests with @group https://redirect.github.com/APIJSON/APIJSON/pull/884/files#top
Show all changes 1 commit https://redirect.github.com/APIJSON/APIJSON/pull/884/files
fd1f15b fix(sql): count groups for HEAD requests with @group lnuxe Nov 11, 2026 https://redirect.github.com/APIJSON/APIJSON/pull/884/commits/fd1f15b8b81eba7ae17ca58b09b907eda39aa9e3
Clear filters https://redirect.github.com/APIJSON/APIJSON/pull/884/files
Please reload this pagehttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
Please reload this pagehttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
AbstractSQLConfig.java https://redirect.github.com/APIJSON/APIJSON/pull/884/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
AbstractSQLConfigGroupCountTest.java https://redirect.github.com/APIJSON/APIJSON/pull/884/files#diff-5ecfc8be33f9d3d6affb17e460d9c70f9228f5e9a3ddb7783dc8a6f99db3f91d
src/main/java/apijson/orm/AbstractSQLConfig.javahttps://redirect.github.com/APIJSON/APIJSON/pull/884/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
View file https://redirect.github.com/lnuxe/APIJSON/blob/fd1f15b8b81eba7ae17ca58b09b907eda39aa9e3/src/main/java/apijson/orm/AbstractSQLConfig.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/APIJSON/APIJSON/pull/884/{{ revealButtonHref }}
https://redirect.github.com/APIJSON/APIJSON/pull/884/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
https://redirect.github.com/APIJSON/APIJSON/pull/884/files#diff-122a62fcb6d18967f07dfc450569028e0705dfabe001a05e4ce57cdab134e16d
src/test/java/apijson/orm/AbstractSQLConfigGroupCountTest.javahttps://redirect.github.com/APIJSON/APIJSON/pull/884/files#diff-5ecfc8be33f9d3d6affb17e460d9c70f9228f5e9a3ddb7783dc8a6f99db3f91d
View file https://redirect.github.com/lnuxe/APIJSON/blob/fd1f15b8b81eba7ae17ca58b09b907eda39aa9e3/src/test/java/apijson/orm/AbstractSQLConfigGroupCountTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/APIJSON/APIJSON/pull/884/{{ revealButtonHref }}
Please reload this pagehttps://redirect.github.com/APIJSON/APIJSON/pull/884/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.