Repository navigation
fix: handle BenchBase metadata and lockop fallback - #27244
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
aptend
left a comment
There was a problem hiding this comment.
Deep review completed on exact head 542276392bd2396073118c5bc004978b759105a1. The LockOp fallback and the non-aggregate HAVING planner change are sound, and focused lockop / planner tests pass. One fixture blocker remains:
- [P2] Preserve the empty
REMARKSvalue in the new BVT result.test/distributed/cases/metadata/mysql_compat_jdbc_get_tables.resultrecordsnullimmediately afterTABLEfor both rows, but a table created without a comment has a non-null emptyrel_comment: catalog insertion appendsschema.CommentwithisNull=false, andinformation_schema.TABLES.TABLE_COMMENTiscast(rel_comment as text). The existing equivalent Connector/J-shaped result intest/distributed/cases/pessimistic_transaction/create_table.resulttherefore has an empty field (eight spaces betweenTABLEand the firstnull). The new BVT will produce that same emptyREMARKS, so these two expected rows will mismatch. Update both rows to keep the empty field before the five trailing null columns (or regenerate the result from the test runner).
XuPeng-SH
left a comment
There was a problem hiding this comment.
Blocking findings on f3039c9:
-
[P1]
pkg/sql/plan/having_binder.go:131binds every column in a non-aggregate HAVING directly against the query input. That bypasses projected-alias resolution, which is exactly what the Connector/J query needs. On an exact-head local MatrixOne instance, the new BVT query returns zero rows:HAVING TABLE_TYPE = 'TABLE'sees the source valueinformation_schema.tables.TABLE_TYPE = 'BASE TABLE', not the projected CASE alias valueTABLE. The two created tables are therefore filtered out. The planner-only test merely checks that planning succeeds and never executes the query, so it misses this failure.The branch also broadens MySQL compatibility incorrectly: with
ONLY_FULL_GROUP_BY, exact head acceptsSELECT n_regionkey FROM nation HAVING n_nationkey > 0; the same harness rejects it on base 4aab5da, and MySQL 8.4 rejects the equivalent query withERROR 1054 Unknown column 'b' in 'having clause'. Please preserve HAVING's alias/visibility rules and relax only the grouping restriction needed for a resolved projected alias, then add execution-level positive and negative regressions. -
[P1]
test/distributed/cases/metadata/mysql_compat_jdbc_get_tables.result:31-32recordsREMARKSasnull, but an exact-head instance returns a non-null emptyTABLE_COMMENT(IF(TABLE_COMMENT IS NULL, 'IS_NULL', CONCAT('[', TABLE_COMMENT, ']'))produced[]for both tables). Once the alias-binding issue is fixed and rows are returned, these expectations will still fail. The existing JDBC metadata fixture underpessimistic_transaction/create_table.resultalso represents this field as empty. Please regenerate the result from a real BVT run.
Validation performed: exact-head package binaries for pkg/sql/plan and pkg/sql/colexec/lockop; full lockop tests passed; targeted new planner/lockop tests passed; go vet passed for both packages; exact-head mo-service execution exposed the two failures above. Q1-Q3 lifecycle audit found no new cleanup, wait-for, or unbounded-growth defect in the lockop change.
|
|
aptend
left a comment
There was a problem hiding this comment.
The latest fixes cover the previously reported alias/direct-column cases, but equivalent database qualification is still rejected.
|
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed current head 5b5ef77. The non-aggregate HAVING visibility rules now distinguish projected aliases, direct projected columns, anonymous expressions, duplicate aliases, and qualified references by resolved binding identity; the latest database-qualification cases close the prior blocker. LockOp fallback/shared-target behavior and the JDBC metadata regressions are covered, and all checks pass. No additional blocking finding.
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 5b5ef776a0300947301c952247ec44560f2ec98d, including all prior feedback. The latest qualification fix closes the previously reported database-qualified case, but output-name resolution still has two MySQL compatibility gaps:
-
[P1] Treat explicit/implicit duplicate output names as ambiguous.
havingOutputExprreturns immediately after finding an explicit alias and never checks unaliased direct projections with the same output name. Consequently, exact head acceptsSELECT n_nationkey AS n_regionkey, n_regionkey FROM nation HAVING n_regionkey > 0and silently binds HAVING ton_nationkey. MySQL 8.4.11 rejects the equivalentSELECT b AS a, a FROM t HAVING a > 0withERROR 1052: Column 'a' in having clause is ambiguous. The checked-in duplicate tests cover explicit/explicit aliases only. Please include implicit output names in the ambiguity set while retaining explicit-alias precedence over a source column that is not separately projected. -
[P2] Preserve the implicit output name for unary-plus column projections. MySQL 8.4.11 accepts
SELECT +a FROM t HAVING a > 0underONLY_FULL_GROUP_BY(the output name isa). Exact head rejects the equivalentSELECT +n_regionkey FROM nation HAVING n_regionkey > 0because only a bare/parenthesizedUnresolvedNameis recognized as an implicit output. Please normalize this no-op wrapper, or otherwise derive the projected output name consistently with MySQL, and add a regression.
Both counterexamples were reproduced in a temporary exact-head planner test; the first unexpectedly returned no error and the second failed with the GROUP BY error. The LockOp changes remain sound under the earlier lifecycle/Q1-Q3 review.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 5b5ef776a0300947301c952247ec44560f2ec98d. The two findings from my previous review are closed, but output-name resolution is still incomplete.
P1: explicit and implicit outputs with the same name must participate in one ambiguity set
pkg/sql/plan/bind_context.go:722-758 first scans explicit aliases and returns immediately at lines 738-740 if any exist; it scans implicit direct-column output names only when there was no explicit match. Therefore this head accepts and silently resolves:
SELECT b AS a, a FROM t HAVING a > 0;to b AS a. MySQL rejects it because the SELECT list exposes two different outputs named a; explicit-alias precedence over an unprojected source column does not make a separately projected a disappear. The current duplicate tests cover only explicit/explicit aliases. Build a single candidate set across explicit and implicit output names, reject semantically different matches, and retain the existing allowance for equivalent duplicates.
P2: preserve MySQL's implicit output name through unary plus
The implicit-name scan only recognizes unwrapParenExpr(field.ast).(*tree.UnresolvedName) at lines 742-748. Consequently SELECT +a FROM t HAVING a > 0 is rejected under ONLY_FULL_GROUP_BY, although unary plus preserves the column's implicit output name and MySQL accepts this form. Normalize this no-op wrapper when deriving output names (without making arbitrary anonymous expressions visible) and add a regression alongside the parenthesized/direct-column cases.
The anonymous-expression and explicit/explicit-alias blockers from the prior head are fixed. The LockOp portion remains sound under the earlier ownership/wait-for review.
|
已修复最新 review 中的两个 planner 问题,并合并最新 upstream/main。
请基于新 head 再次 review,谢谢。 |
aptend
left a comment
There was a problem hiding this comment.
Deep re-review completed against exact head e9b12676d1c4a9e50f36ba08c6357eef26fea7e7. The prior explicit/implicit collision and single-unary-plus cases are improved, but unary-plus normalization is still inconsistent across equivalent output matching, qualified projections, and nested no-op expressions. I reproduced the counterexamples locally and compared them with MySQL 9.6.0 under ONLY_FULL_GROUP_BY.
|
已根据最新 review 修复 unary-plus 一致性问题,并合并最新
请基于新 head 再次 review,谢谢。 |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review completed on exact head cdcb5e4. The current implementation closes the prior HAVING blockers: anonymous expressions do not gain output visibility, explicit and implicit duplicate names share one ambiguity set, qualified references compare resolved binding identity, and parentheses/recursive unary plus use one normalized direct-column identity without broadening arbitrary expressions. The JDBC alias case and updated direct-projection result baselines are consistent with those rules. No new blocking correctness, lifecycle, or complexity issue found. Validation: all focused positive/negative HAVING cases under -race -count=20, full pkg/sql/plan, and diff hygiene passed.
aptend
left a comment
There was a problem hiding this comment.
Deep re-review completed on exact head 73c8280 against base c6b2ac9. I read the complete review/comment/thread history, checked the increment since the previously reviewed heads and re-audited the full diff. The prior HAVING visibility, ambiguity, qualification, and unary-plus normalization issues are closed, including the current merge resolution, and I found no new blocker. Validation: git diff --check; make thirdparties; make cgo; go test -count=1 -timeout=300s ./pkg/sql/plan.
LeftHandCold
left a comment
There was a problem hiding this comment.
Deep re-review completed on exact head 73c8280e71a5a362157d928421f72138e372ffa5 against base c6b2ac9c1eaff0db867e845723a8ce1d2102928f. The previous alias/ambiguity/qualification/unary-plus findings are closed, but one concrete MySQL compatibility blocker remains in the new non-aggregate HAVING resolution. I reproduced it both with an exact-head planner regression and against a disposable MySQL 8.0.26 oracle under ONLY_FULL_GROUP_BY; details and the required positive/negative boundary are in the inline comment. The current Linux UT failure is Test_UpgradeEntry timing out in logservice startup and does not appear related to this planner diff, so it is not part of this request for changes.
|
Fixed the remaining P1 in commit
Validation:
The previous Ubuntu UT failure ( |
|
Follow-up commit The targeted planner tests (including |
LeftHandCold
left a comment
There was a problem hiding this comment.
Deep re-review completed on exact head ffcb0fd against base d7899e7. The prior unqualified projected-source blocker is fixed by resolving output names first and then matching a directly projected source by binding identity; the follow-up ambiguity guard preserves multi-table ambiguous-column errors. I re-audited the full current diff and found no new blocking correctness, compatibility, lifecycle, or complexity issue. Validation: git diff --check; exact-head CGo rebuild; GOWORK=off package selection/build/vet; 29 focused ONLY_FULL_GROUP_BY/native-boundary tests; full pkg/sql/plan; latest GitHub CI green.
Merge Queue Status
This pull request spent 6 hours 56 minutes 52 seconds in the queue, including 48 minutes 53 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #27242
#25103
What this PR does / why we need it:
修复 BenchBase/JDBC 元数据查询
修复 LockOp 空指针 panic