fix(core): fix incorrect error handling, which can leave table reader in an inconsistent state#6108
fix(core): fix incorrect error handling, which can leave table reader in an inconsistent state#6108bluestreak01 merged 3 commits intomasterfrom
Conversation
… in an inconsistent state
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
core/src/main/java/io/questdb/griffin/SqlOptimiser.java (1)
2782-2807: Don’t bypass QueryModel’s invariants: use addBottomUpColumn instead of mutating maps/lists directlyDirectly writing to aliasToColumnMap and bottomUpColumns risks leaving columnNameToAliasMap, alias indexes, wildcard lists, etc., out of sync. This can later break column resolution and rewrites. Also, keep source position when replacing ORDER BY with a literal, and avoid var for codebase consistency.
- if (node.type == FUNCTION || node.type == OPERATION) { - var qc = findQueryColumnByAst(model.getBottomUpColumns(), node); + if (node.type == FUNCTION || node.type == OPERATION) { + QueryColumn qc = findQueryColumnByAst(model.getBottomUpColumns(), node); if (qc == null) { // add this function to bottom-up columns and replace this expression with index - CharSequence alias = SqlUtil.createColumnAlias( + CharSequence alias = SqlUtil.createColumnAlias( characterStore, node.token, Chars.indexOfLastUnquoted(node.token, '.'), model.getAliasToColumnMap(), true ); - qc = queryColumnPool.next().of( - alias, - node, - false - ); - model.getAliasToColumnMap().put(alias, qc); - model.getBottomUpColumns().add(qc); + qc = queryColumnPool.next().of(alias, node, false); + // Keep QueryModel internal structures consistent + model.addBottomUpColumn(qc); moved = true; } // on "else" branch, when order by expression matched projection // we can just replace order by with projection alias without having to // add an extra model - orderBy.setQuick(i, nextLiteral(qc.getAlias())); + orderBy.setQuick(i, nextLiteral(qc.getAlias(), node.position)); }
🧹 Nitpick comments (1)
core/src/main/java/io/questdb/griffin/SqlOptimiser.java (1)
2312-2320: Annotate nullable return for clarityThis returns null when no match is found. Add an explicit @nullable to improve readability and static analysis.
- private QueryColumn findQueryColumnByAst(ObjList<QueryColumn> bottomUpColumns, ExpressionNode node) { + private @Nullable QueryColumn findQueryColumnByAst(ObjList<QueryColumn> bottomUpColumns, ExpressionNode node) {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
core/src/main/java/io/questdb/cairo/vm/MemoryCMRImpl.java(1 hunks)core/src/main/java/io/questdb/griffin/SqlOptimiser.java(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-arm64)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-x64-zfs)
- GitHub Check: New pull request (SelfHosted Other tests on linux-x64-zfs)
- GitHub Check: New pull request (SelfHosted Other tests on linux-arm64)
- GitHub Check: New pull request (Rust Test and Lint on linux-jdk17)
- GitHub Check: New pull request (Hosted Running tests on windows-other)
- GitHub Check: New pull request (Hosted Running tests on windows-pgwire)
- GitHub Check: New pull request (Hosted Running tests on windows-cairo)
- GitHub Check: New pull request (Hosted Running tests on windows-fuzz2)
- GitHub Check: New pull request (Hosted Running tests on windows-fuzz1)
- GitHub Check: New pull request (Hosted Running tests on windows-griffin)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-other)
- GitHub Check: New pull request (Hosted Running tests on mac-other)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-pgwire)
- GitHub Check: New pull request (Hosted Running tests on mac-pgwire)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-cairo)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo-fuzz)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-fuzz)
- GitHub Check: New pull request (Hosted Running tests on mac-cairo)
- GitHub Check: New pull request (SelfHosted Other tests Start X64Zfs Agent)
- GitHub Check: New pull request (Hosted Running tests on mac-griffin)
- GitHub Check: New pull request (Hosted Running tests with cover on linux-griffin)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests Start X64Zfs Agent)
- GitHub Check: New pull request (SelfHosted Other tests Start ARM Agent)
- GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests Start ARM Agent)
- GitHub Check: New pull request (Check Changes Check changes)
- GitHub Check: build
- GitHub Check: build
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
[PR Coverage check]😍 pass : 14 / 14 (100.00%) file detail
|
found by a fuzz test:
Removed implicit contract that failure to extend memory will close the memory.