Skip to content

Fix Prepared Table-Model INSERT VALUES Execution - #19078

Open
Caideyipi wants to merge 2 commits into
masterfrom
feat/readonly-sql
Open

Caideyipi wants to merge 2 commits into
masterfrom
feat/readonly-sql

Conversation

@Caideyipi

@Caideyipi Caideyipi commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR fixes prepared table-model INSERT ... VALUES execution.

Prepared VALUES rows and failed-measurement details must be included in prepared-statement memory accounting. Analysis can also mutate the stored InsertRows AST, making repeated EXECUTE calls unreliable. This change accounts for the retained data, analyzes a per-execution copy, and attaches the query context to the resolved INSERT.

Tests

  • Unit coverage checks VALUES memory accounting, retained parse-failure data, and repeated analysis.
  • Integration coverage checks repeated prepared execution and EXECUTE IMMEDIATE.
  • mvn spotless:apply -P with-integration-tests -o passed. Targeted unit and integration tests were not run for this update.

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.17%. Comparing base (8a5e5ca) to head (395a986).
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
.../apache/iotdb/db/queryengine/plan/Coordinator.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19078      +/-   ##
============================================
+ Coverage     48.05%   48.17%   +0.11%     
- Complexity      604      625      +21     
============================================
  Files          5572     5572              
  Lines        410195   411602    +1407     
  Branches      54112    54197      +85     
============================================
+ Hits         197124   198292    +1168     
- Misses       213071   213310     +239     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Reviewed the complete diff at 46dbb5c06134a3cb4829ff3ff7b501ff672a89ab against base cc8e94781a1a816fc0fa3a07f588b1f5b2a63ae0. The changed behavior is covered by the PR description: early read-only validation for tree/table SQL (including resolved EXPLAIN, EXECUTE, and EXECUTE IMMEDIATE statements), disk-recovery and session-operation exceptions, prepared INSERT VALUES copying and memory accounting, and preserving internal attribute-sync registration. I found no undeclared behavior or actionable findings. I did not rerun tests; the PR description records 119 targeted DataNode unit tests, reactor test compilation, Spotless, Checkstyle, and whitespace checks as passing, and states that integration tests were not rerun.

@Caideyipi Caideyipi changed the title Enforce SQL read-only checks before analysis Enforce SQL read-only checks and fix prepared INSERT execution Nov 2, 2026
@Caideyipi Caideyipi changed the title Enforce SQL read-only checks and fix prepared INSERT execution Validate Read-Only SQL Before Analysis and Fix Prepared VALUES Inserts Nov 2, 2026
@jt2594838
jt2594838 self-requested a review November 2, 2026 10:27
@Caideyipi Caideyipi changed the title Validate Read-Only SQL Before Analysis and Fix Prepared VALUES Inserts Fix Prepared Table-Model INSERT VALUES Execution Nov 2, 2026
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Re-review at 395a9866a80a3a6395dbe60fa7cb69d9e406b03e found the coordinator-level read-only validator was unrelated to the prepared VALUES issue and could reject a request before it was routed to the node that performs the write. Removed that validator and its dedicated tests, including the read-only portions of the mixed integration test. Kept the prepared VALUES memory accounting, per-execution AST copy, resolved INSERT query context, and their regression coverage.

Validation: mvn spotless:apply -P with-integration-tests -o and git diff --check passed. The targeted unit and integration tests were not run in this update.

Reviewed SHA: 395a9866a80a3a6395dbe60fa7cb69d9e406b03e
Final local SHA: 395a9866a80a3a6395dbe60fa7cb69d9e406b03e
Confirmed remote branch and PR SHA: 395a9866a80a3a6395dbe60fa7cb69d9e406b03e

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants