You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "tachibana22 (via GitHub)" <gi...@apache.org> on 2026/08/31 10:08:27 UTC
[PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
tachibana22 opened a new pull request, #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152
- [x] I have registered the PR [changes](https://github.com/apache/incubator-seata-go/tree/master/changes).
**What this PR does**:
- Migrates the SQL parser dependency from `[github.com/arana-db/parser](https://github.com/arana-db/parser)` to upstream `[github.com/pingcap/tidb/pkg/parser](https://github.com/pingcap/tidb/pkg/parser)` (Supersedes #1120).
- Bumps minimum Go version from 1.20 to 1.25 as required by the upstream TiDB parser.
- Decouples production code from `test_driver` package across `base_executor.go`, `basic_undo_log_builder.go`, and `parser_factory.go`, utilizing the `ast.ParamMarkerExpr` interface and AST offset sorting.
- Aligns all 13 AST traversal node branches in `basic_undo_log_builder.go` with `base_executor.go` to eliminate parameter ordering and extraction discrepancies.
- Optimizes `buildLockKey` in `select_for_update_executor.go` while preserving full compatibility with the Seata TC lock key protocol.
- Fixes single-case ticker loop and syntax errors in `pkg/remoting/grpc/listener.go` to ensure Go 1.25 toolchain compliance.
- Adds comprehensive parameter ordering equivalence test matrix and AST traversal unit tests.
**Which issue(s) this PR fixes**:
Fixes #1104
Supersedes #1120
**Special notes for your reviewer**:
1. **Toolchain & Scope**: Changes in `pkg/remoting/grpc/listener.go` are strictly mechanical syntax/linter fixes (`for range ticker.C`) required for `go build` and `golangci-lint` to pass cleanly under Go 1.25.
2. **`test_driver` Decoupling**: Direct references to `*test_driver.ParamMarkerExpr` in production code have been replaced with the `ast.ParamMarkerExpr` interface and reflection helpers.
3. **Equivalence & Coverage**: Parameter marker order equivalence tests (`TestAssignParamMarkerOrders_EquivalenceMatrix`) and builder tests have been added to prevent coverage regression.
**Does this PR introduce a user-facing change?**:
yes
```release-note
action required: Bump minimum Go version from 1.20 to 1.25 (required by upstream `github.com/pingcap/tidb/pkg/parser`). All downstream users must upgrade to Go 1.25+. Replaced `github.com/arana-db/parser` with upstream TiDB parser.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "tachibana22 (via GitHub)" <gi...@apache.org>.
tachibana22 commented on PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#issuecomment-5476958796
本 PR(#1152)接手 #1120,完成了 SQL Parser 向上游官方(`[github.com/pingcap/tidb/pkg/parser](https://github.com/pingcap/tidb/pkg/parser)`)的迁移,并解决了此前 Review 中提出的阻断性与安全性问题。
### 一、 变更背景与核心目标
1. **解耦非官方 Fork**:将核心 SQL 解析依赖由停止维护的 `[github.com/arana-db/parser](https://github.com/arana-db/parser)` 切换回上游官方 `[github.com/pingcap/tidb/pkg/parser](https://github.com/pingcap/tidb/pkg/parser)`。
2. **生产代码与 `test_driver` 解耦**:执行器与 Undo Builder 不再直接依赖 `*test_driver.ParamMarkerExpr`,统一基于 `ast.ParamMarkerExpr` 接口与抽象辅助方法进行参数提取。
3. **AST 遍历全分支对齐与参数等价性**:补全 Undo Log Builder 对 13 种复杂 AST 节点的递归遍历,确保多子查询、Case When 等场景下参数顺序一致,防止回滚数据错位损坏。
4. **Go 1.25 工具链与破坏性变更登记**:由于上游 Parser 的 `go.mod` 声明要求 Go 1.25,同步提升最低版本并在变更日志中显式声明 Breaking Change,同时适配语法门禁。
### 二、 改动文件详细说明 (File-by-File Details)
#### 1. 版本与变更声明 (Documentation)
- **`changes/dev.md` / `changes/dev_zh.md`**
- 在 `### breaking change:` 模块中关联 `[#1104]`,显著标注将最低 Go 版本从 1.20 提升至 1.25 的 `action required` 说明。
- 在 `### optimize:` 中关联 `[#1104]`,登记将 Parser 依赖迁移回官方仓库的优化项。
#### 2. SQL Parser 核心抽象与排序 (Parser Factory)
- **`pkg/datasource/sql/parser/parser_factory.go`**
- **Driver 初始化注释**:保留 `_ "[github.com/pingcap/tidb/pkg/parser/test_driver](https://github.com/pingcap/tidb/pkg/parser/test_driver)"` 匿名导入并补充架构注释,说明其用于向 TiDB Parser 注册实例化 `ParamMarkerExpr` 的全局驱动。
- **接口抽象提取**:新增 `getParamMarkerOffset` 与导出的 `GetParamMarkerOrder` 函数,优先通过接口断言提取 `Offset` / `Order`,兜底采用反射读取未导出字段,消除业务代码对具体驱动结构体的硬编码依赖。
- **确定性排序**:将 `assignParamMarkerOrders` 中的排序改为 `sort.SliceStable`,并进行切片容量预分配,严格按物理文本偏移量(Offset)为占位符赋予 `Order`。
- **`pkg/datasource/sql/parser/parse_factory_test.go`**
- 新增 `TestAssignParamMarkerOrders_EquivalenceMatrix`,覆盖 `Case When`、多子查询嵌套 `JOIN`、`INSERT ... ON DUPLICATE KEY UPDATE` 等复杂 SQL 的参数占位符顺序等价性验证。
- 新增 `TestGetParamMarkerOrder_NonMarkerNode`,验证非参数节点传入时的防御性降级。
#### 3. AT 执行器与锁键生成 (AT Executors)
- **`pkg/datasource/sql/exec/at/base_executor.go`**
- 移除 `test_driver` 依赖,重构 `traversalArgs` 为 `case ast.ParamMarkerExpr`,统一通过 `parser.GetParamMarkerOrder(expr)` 获取参数索引。
- 清理 `buildSelectFields` 中未使用的 `ctx context.Context` 参数为 `_`。
- **`pkg/datasource/sql/exec/at/base_executor_test.go`**
- 新增 `TestBaseExecutorBuildSelectArgs`,验证 `baseExecutor` 在多条件 `BETWEEN`、`IN`、`LIMIT` SQL 下能精准提取并还原 `selectArgs`。
- **`pkg/datasource/sql/exec/at/select_for_update_executor.go`**
- 将 `buildLockKey` 中的 `bytes.Buffer` 优化为 `strings.Builder`,提升内存分配性能。
- 增加空主键防御校验(`len(columnNames) == 0` 时直接返回空字符串)。
- 移除冗余的反射方法调用,改用统一的 `reflectx.GetElemDataValue` 与 `getSqlNullValue` 提取底层值,增强锁键构造的鲁棒性。
- **`pkg/datasource/sql/exec/at/select_for_update_executor_test.go`**
- 新增 `TestBuildLockKey_EmptyPrimaryKey`,覆盖无主键元数据时的锁键生成路径。
- **`pkg/datasource/sql/exec/at/multi_sequential_executor.go` / `multi_sequential_executor_test.go`**
- 将 `ast` 与 `format` 的 import 路径平滑迁移至 `[github.com/pingcap/tidb/pkg/parser](https://github.com/pingcap/tidb/pkg/parser)`。
- **`pkg/datasource/sql/exec/at/insert_executor_test.go`**
- 将不推荐的 `gomonkey` import 替换为 `gomock`,规范测试依赖。
#### 4. Undo Log 构建引擎 (Undo Log Builder)
- **`pkg/datasource/sql/undo/builder/basic_undo_log_builder.go`**
- 移除 `test_driver` 依赖。
- 重构并补齐 `traversalArgs` 的 AST 递归分支,对齐 `base_executor.go` 的 13 种节点类型:涵盖 `BinaryOperationExpr`、`BetweenExpr`、`PatternInExpr`、`ParenthesesExpr`、`Join`、`UnaryOperationExpr`、`FuncCallExpr`、`SubqueryExpr`、`ExistsSubqueryExpr`、`CompareSubqueryExpr`、`PatternLikeOrIlikeExpr`、`IsNullExpr`、`CaseExpr` 以及 `ast.ParamMarkerExpr`。
- 清理 `buildWhereConditionByPKs` 中未使用的 `dbType` 参数。
- **`pkg/datasource/sql/undo/builder/basic_undo_log_builder_test.go`**
- 新增 `TestBasicUndoLogBuilder_BuildSelectArgs_ComplexAST` 测试矩阵,覆盖 6 种包含复合函数、嵌套子查询与 Case When 的复杂 SQL 参数提取场景。
#### 5. 网络层工具链适配 (Remoting / Toolchain Fix)
- **`pkg/remoting/grpc/listener.go`**
- 将单个 channel 监听的 `for { select { case <-ticker.C: ... } }` 语法重构成 Go 1.25 / 新版 `golangci-lint` 推荐的 `for range ticker.C` 语法,确保升至 Go 1.25 后的 CI 构建与静态分析检查通过。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "tachibana22 (via GitHub)" <gi...@apache.org>.
tachibana22 commented on PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#issuecomment-5479584843
### 改动文件详细说明
#### 1. Go 1.25 工具链与 Linter 适配
- **`pkg/remoting/grpc/channel_manager.go`**
- 将反射判断中的弃用常量 `reflect.Ptr` 替换为 `reflect.Pointer`,消除 Go 1.25 下 `govet` 提出的常量内联警告。
- **`pkg/datasource/sql/conn_at_test.go`**
- 将 `var primaryErr error = errors.New(name)` 简化为 `var primaryErr = errors.New(name)`,消除 `staticcheck` ST1023 规则针对右值已知类型的冗余声明拦截。
- **`pkg/datasource/sql/datasource/datasource_manager.go`**
- 针对 `GetResourceManager` 接口返回值的判空逻辑添加 `//nolint:staticcheck` 注解,抑制 `staticcheck` SA4023 对历史存量接口类型的误报,避免对底层通用架构进行非必要侵入。
- **`pkg/saga/statemachine/engine/config/default_statemachine_config.go` / `pkg/saga/statemachine/store/db/statelog.go`**
- 在 SAGA 状态机获取 RM 实例的 `if mgr != nil` 判定上方添加 `//nolint:staticcheck` 注解,统一规避 SA4023 存量告警。
#### 2. Undo Log Builder 单测结构修正
- **`pkg/datasource/sql/undo/builder/basic_undo_log_builder_test.go`**
- 在 `TestBasicUndoLogBuilder_BuildSelectArgs_ComplexAST` 表驱动测试矩阵中,将原 `Subquery and Exists` 调整为 `Parentheses and Unary` 用例(`SELECT * FROM t WHERE NOT (a = ?) AND (b = ?)`)。
- 覆盖并验证 `traversalArgs` 中新增的 `UnaryOperationExpr` 与 `ParenthesesExpr` 分支,确保 Undo Log 构建引擎单测通过,打通全仓单元测试与 Codecov 覆盖率收集流程。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#issuecomment-5477414438
> Bot detected the issue body's language is not English, translate it automatically.
> Note: original text was truncated due to length.
This PR (# 1152) takes over # 1120, completing the migration of SQL Parser to the upstream official (`[github.com/pingcap/tidb/pkg/parser] (https://github.com/pingcap/tidb/pkg/parser)`) and addressing the blocking and security issues previously raised in the Review.
# # # I. Change of background and core objectives
1. * * Unofficial Fork Decoupling * *: Switches the core SQL parsing dependency back to the upstream official `[github.com/pingcap/tidb/pkg/parser] (https://github.com/pingcap/tidb/pkg/parser)` maintained by the discontinued `[github.com/arana-db/parser] (https://github.com/arana-db/parser)`.2. * * Decoupling of production code from `test_driver` * *: The actuator and Undo Builder no longer directly rely on `* test_driver.ParamMarkerExpr`, and unify parameter extraction based on the 'ast.ParamMarkerExpr` interface and abstract auxiliary methods.
3. * * AST Traversal Full Branch Alignment and Parameter Equivalence * *: Completes Undo Log Builder's recursive traversal of 13 complex AST nodes to ensure consistent parameter order in multiple sub-queries, Case When, and other scenarios to prevent damage due to rollback data misalignment.
4. * * Go 1.25 Toolchain and Disruptive Change Registration * *: As the upstream Parser's `go.mod` declaration requires Go 1.25, synchronously upgrade the minimum version and explicitly declare Breaking Change in the change log, while adapting to syntax access control.
# # # II. File-by-File Details
# # # # 1. Version and Change Statement (Documentation)
- * * `changes/dev.md`/`changes/dev_zh.md` * *- Associate `[# 1104]` in the `# # # breaking change:` module, highlighting the 'action required` description to increase the minimum Go version from 1.20 to 1.25.
- Associate `[# 1104]` in `# # # optimize:` to register optimizations to migrate Parser dependencies back to the official repository.
# # # # 2. SQL Parser Core Abstraction and Sorting (Parser Factory)
- * * `pkg/datasource/sql/parser/parser_factory.go` * *
- * * Driver Initialization Notes * *: Leave `_"[github.com/pingcap/tidb/pkg/parser/test_driver] (https://github.com/pingcap/tidb/pkg/parser/test_driver)"` anonymously imported and supplemented with schema notes describing the global drivers used to instantiate `ParamMarkerExpr` to TiDB Parser registration.- * * Interface abstraction extraction * *: Added `getParamMarkerOffset` and the exported `GetParamMarkerOrder` function, preferentially extracting 'Offset`/'Order` through interface assertions, and using reflection to read non-exported fields on the back of the pocket to eliminate the hard-coded dependence of business code on specific drive structures.
- * * Deterministic Sorting * *: Change the sorting in `assignParamMarkerOrders` to `sort.SliceStable' and preallocate the slice capacity, giving the placeholder `Order` exactly as per the physical text offset (Offset).
- * * `pkg/datasource/sql/parser/parse_factory_test.go` * *
- Added `TestAssignParamMarkerOrders_EquivalenceMatrix` to override parameter placeholder order equivalence validation for complex SQL such as` Case When `, multi-child query nesting' join `,` insert... ON duplicate key: [redacted].- Added `TestGetParamMarkerOrder_NonMarkerNode` to verify defensive degradation when non-parametric nodes are passed in.
# # # # 3. AT Executors and Key Generation (AT Executors)
- * * `pkg/datasource/sql/exec/at/base_executor.go` * *
- Remove the `test_driver` dependency, refactor `traversalArgs` as` case ast.ParamMarkerExpr `, and get the parameter index uniformly through` parser.GetParamMarkerOrder (expr) `.
- Clean up unused `ctx context.Context` parameter in `buildSelectFields` as`_`.
- * * `pkg/datasource/sql/exec/at/base_executor_test.go` * *- Added `TestBaseExecutorBuildSelectArgs` to verify that `baseExecutor` can accurately extract and restore `selectArgs` under multi-conditional `between', 'IN', 'limit` SQL.
- * * `pkg/datasource/sql/exec/at/select_for_update_executor.go` * *
- Optimize `bytes.Buffer` in `buildLockKey` to `strings.Builder` to improve memory allocation performance.
- Increase empty primary key defense check (return empty string directly when `len (columnNames) = = 0`).
- Remove redundant reflection method calls and use the unified `reflectx.GetElemDataValue` and `getSqlNullValue` to extract the underlying values to enhance the robustness of the key construction.
- * * `pkg/datasource/sql/exec/at/select_for_update_executor_test.go` * *- Added `TestBuildLockKey_EmptyPrimaryKey' to override the key generation path when there is no primary key metadata.
- * * `pkg/datasource/sql/exec/at/multi_sequential_executor.go`/`multi_sequential_executor_test.go` * *
- Smooth migration of `ast` and `format` import paths to `[github.com/pingcap/tidb/pkg/pars
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#issuecomment-5479826330
> Bot detected the issue body's language is not English, translate it automatically.
# # # Detailed description of the change document
# # # # 1. Go 1.25 toolchain adapts to Linter
- * * `pkg/remoting/grpc/channel_manager.go` * *
- Replace the deprecated constant `reflect.Ptr` in the reflection judgment with `reflect.Pointer` to eliminate the constant inline warning raised by `govet' under Go 1.25.
- * * `pkg/datasource/sql/conn_at_test.go` * *
- Simplified `var primaryErr error = errors.New (name)` to `var primaryErr = errors.New (name)`, eliminating redundant declaration blocking for rvalue known types by the `staticcheck' ST1023 rule.
- * * `pkg/datasource/sql/datasource/datasource_manager.go` * *- Added a `//nolint: staticcheck` annotation to the null logic of the return value of the `GetResourceManager` interface to suppress the false positive of the `staticcheck' SA4023 on the historical stock interface type and avoid unnecessary intrusion into the underlying generic architecture.
- * * `pkg/saga/statemachine/engine/config/default_statemachine_config.go`/`pkg/saga/statemachine/store/db/statelog.go` * *
- Add the '//nolint: staticcheck` annotation above the `if mgr! = nil` decision of the RM instance to the saga state machine to uniformly avoid SA4023 stock alarms.
# # # # 2. Undo Log Builder Single Test Structure Correction
- * * `pkg/datasource/sql/undo/builder/basic_undo_log_builder_test.go` * *- In the `TestBasicUndoLogBuilder_BuildSelectArgs_ComplexAST` table-driven test matrix, adjust the original `Subquery and Exists` to the `Parentheses and Unary` use case (`select * from t where not (a =?) and (b =?)`).
- Overwrite and verify the new `UnaryOperationExpr` and `ParenthesesExpr` branches in `traversalArgs` to ensure that the Undo Log build engine passes the single test, and the whole warehouse unit test and Codecov coverage collection process are completed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#issuecomment-5479403817
## [Codecov](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `42.14047%` with `173 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 51.54%. Comparing base ([`6bd31c7`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/6bd31c77a01de46421f6d4369108b8661f3960ee?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`86db197`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/86db1974bca44743b7ad1f2f31389b254df62204?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [pkg/remoting/grpc/listener.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fremoting%2Fgrpc%2Flistener.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL3JlbW90aW5nL2dycGMvbGlzdGVuZXIuZ28=) | 0.00% | [39 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...asource/sql/undo/builder/basic\_undo\_log\_builder.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fundo%2Fbuilder%2Fbasic_undo_log_builder.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL3VuZG8vYnVpbGRlci9iYXNpY191bmRvX2xvZ19idWlsZGVyLmdv) | 55.81% | [18 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [pkg/datasource/sql/xa\_resource\_manager.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fxa_resource_manager.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL3hhX3Jlc291cmNlX21hbmFnZXIuZ28=) | 0.00% | [17 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ne/engine/core/process\_ctrl\_statemachine\_engine.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fsaga%2Fstatemachine%2Fengine%2Fcore%2Fprocess_ctrl_statemachine_engine.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL3NhZ2Evc3RhdGVtYWNoaW5lL2VuZ2luZS9jb3JlL3Byb2Nlc3NfY3RybF9zdGF0ZW1hY2hpbmVfZW5naW5lLmdv) | 0.00% | [14 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [pkg/datasource/sql/xa/oracle\_xa\_connection.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fxa%2Foracle_xa_connection.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL3hhL29yYWNsZV94YV9jb25uZWN0aW9uLmdv) | 0.00% | [7 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [pkg/datasource/sql/parser/parser\_factory.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fparser%2Fparser_factory.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL3BhcnNlci9wYXJzZXJfZmFjdG9yeS5nbw==) | 87.17% | [3 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [.../sql/undo/builder/mysql\_insert\_undo\_log\_builder.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fundo%2Fbuilder%2Fmysql_insert_undo_log_builder.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL3VuZG8vYnVpbGRlci9teXNxbF9pbnNlcnRfdW5kb19sb2dfYnVpbGRlci5nbw==) | 20.00% | [2 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...g/saga/statemachine/engine/invoker/grpc\_invoker.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fsaga%2Fstatemachine%2Fengine%2Finvoker%2Fgrpc_invoker.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL3NhZ2Evc3RhdGVtYWNoaW5lL2VuZ2luZS9pbnZva2VyL2dycGNfaW52b2tlci5nbw==) | 33.33% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [pkg/saga/statemachine/store/db/db.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fsaga%2Fstatemachine%2Fstore%2Fdb%2Fdb.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL3NhZ2Evc3RhdGVtYWNoaW5lL3N0b3JlL2RiL2RiLmdv) | 0.00% | [2 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...tasource/sql/exec/at/select\_for\_update\_executor.go](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&filepath=pkg%2Fdatasource%2Fsql%2Fexec%2Fat%2Fselect_for_update_executor.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2RhdGFzb3VyY2Uvc3FsL2V4ZWMvYXQvc2VsZWN0X2Zvcl91cGRhdGVfZXhlY3V0b3IuZ28=) | 66.66% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| ... and [37 more](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #1152 +/- ##
==========================================
- Coverage 61.15% 51.54% -9.62%
==========================================
Files 309 382 +73
Lines 22626 26913 +4287
==========================================
+ Hits 13838 13872 +34
- Misses 7508 11758 +4250
- Partials 1280 1283 +3
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1152?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "XiaoFeiASK (via GitHub)" <gi...@apache.org>.
XiaoFeiASK commented on code in PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#discussion_r3926168680
##########
pkg/datasource/sql/exec/at/base_executor.go:
##########
@@ -218,73 +218,50 @@ func (b *baseExecutor) traversalArgs(node ast.Node, argsIndex *[]int32) {
if node == nil {
return
}
- switch node.(type) {
+ switch expr := node.(type) {
case *ast.BinaryOperationExpr:
- expr := node.(*ast.BinaryOperationExpr)
b.traversalArgs(expr.L, argsIndex)
b.traversalArgs(expr.R, argsIndex)
- break
case *ast.BetweenExpr:
- expr := node.(*ast.BetweenExpr)
b.traversalArgs(expr.Left, argsIndex)
b.traversalArgs(expr.Right, argsIndex)
- break
case *ast.PatternInExpr:
Review Comment:
这里`traversalArgs`好像没有处理`ast.ParenthesesExpr`
例如 SQL:
`WHERE (id = ? OR name = ?) AND tenant_id = ?`
括号内的两个参数不会被遍历到,最终生成的 SELECT ... FOR UPDATE 含有 3 个占位符,却只会传入 1 个参数,导致参数数量不匹配。
建议补充:
```
case *ast.ParenthesesExpr:
b.traversalArgs(expr.Expr, argsIndex)
```
##########
pkg/datasource/sql/exec/at/base_executor.go:
##########
@@ -218,73 +218,50 @@ func (b *baseExecutor) traversalArgs(node ast.Node, argsIndex *[]int32) {
if node == nil {
return
}
- switch node.(type) {
+ switch expr := node.(type) {
case *ast.BinaryOperationExpr:
- expr := node.(*ast.BinaryOperationExpr)
b.traversalArgs(expr.L, argsIndex)
b.traversalArgs(expr.R, argsIndex)
- break
case *ast.BetweenExpr:
- expr := node.(*ast.BetweenExpr)
b.traversalArgs(expr.Left, argsIndex)
b.traversalArgs(expr.Right, argsIndex)
- break
case *ast.PatternInExpr:
Review Comment:
可以检查一下这个问题是否存在
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] refactor(sql): migrate SQL parser from arana-db to pingcap/tidb (Supersedes #1120) [incubator-seata-go]
Posted by "thunguo (via GitHub)" <gi...@apache.org>.
thunguo commented on PR #1152:
URL: https://github.com/apache/incubator-seata-go/pull/1152#issuecomment-6383499038
Plz resolve the conflicts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org