This is an automated email from the ASF dual-hosted git repository. chengzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push: new 1cde9f35a50 Fix not return generate key when id set null (#35783) 1cde9f35a50 is described below commit 1cde9f35a50242a0704c387b72e4e81139ebdd5b Author: zhaojinchao <zhaojinc...@apache.org> AuthorDate: Thu Jun 26 10:18:21 2025 +0800 Fix not return generate key when id set null (#35783) * Fix not return generate key when id set null * Add document --- RELEASE-NOTES.md | 1 + .../segment/insert/keygen/engine/GeneratedKeyContextEngine.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index ddf2ca2f36a..7238a4d5941 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -67,6 +67,7 @@ 1. Proxy: Fix NoSuchElementException exception when execute MySQL SHOW VARIABLES without current database - [#35550](https://github.com/apache/shardingsphere/pull/35550) 1. Parser: Refactor pivot and unpivot clause handling to support multiple column names - [35586](https://github.com/apache/shardingsphere/pull/35586) 1. JDBC: Resolve statement manager leaks when creating multiple statements - [#35665](https://github.com/apache/shardingsphere/pull/35665) +1. Kernel: Fix not return generate key when id set null - [35783](https://github.com/apache/shardingsphere/pull/35783) ### Change Logs diff --git a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java index c6d812e95d3..954f1457e45 100644 --- a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java +++ b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java @@ -103,7 +103,9 @@ public final class GeneratedKeyContextEngine { result.getGeneratedValues().add((Comparable<?>) params.get(((ParameterMarkerExpressionSegment) expression).getParameterMarkerIndex())); } } else if (expression instanceof LiteralExpressionSegment) { - result.getGeneratedValues().add((Comparable<?>) ((LiteralExpressionSegment) expression).getLiterals()); + if (null != ((LiteralExpressionSegment) expression).getLiterals()) { + result.getGeneratedValues().add((Comparable<?>) ((LiteralExpressionSegment) expression).getLiterals()); + } } } return result;