Uh oh!
There was an error while loading. Please reload this page.
[feat](nereids) Add session variable enable_insert_value_auto_cast for insert value truncate long string - #55325
Merged
Conversation
hello-stephen
commented
Aug 26, 2025
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
yujun777
marked this pull request as ready for review
August 26, 2025 15:28
yujun777force-pushed
the
fix-insert-value-strict-mode
branch
from
August 27, 2025 03:57
3699698 to
f20d26eCompare| } else if (needTruncateStringWhenInsert && sourceLength > targetLength && targetLength >= 0) { | ||
| } else if (needTruncateStringWhenInsert | ||
| && sourceLength > targetLength && targetLength >= 0 | ||
| && ConnectContext.get() != null |
Contributor
There was a problem hiding this comment.
don't compute ConnectContext.get() in loop
ContributorAuthor
There was a problem hiding this comment.
don't compute
ConnectContext.get()in loop
fix
yujun777
commented
Aug 27, 2025
ContributorAuthor
run buildall |
yujun777
commented
Aug 27, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Aug 27, 2025
TPC-H: Total hot run time: 34238 ms |
doris-robot
commented
Aug 27, 2025
TPC-DS: Total hot run time: 187675 ms |
doris-robot
commented
Aug 27, 2025
ClickBench: Total hot run time: 32.72 s |
hello-stephen
commented
Aug 27, 2025
Contributor
FE UT Coverage ReportIncrement line coverage |
morrySnow
approved these changes
Aug 27, 2025
Contributor
PR approved by at least one committer and no changes requested. |
Contributor
PR approved by anyone and no changes requested. |
yujun777
commented
Aug 27, 2025
ContributorAuthor
run p0 |
1 similar comment
yujun777
commented
Aug 27, 2025
ContributorAuthor
run p0 |
yujun777
commented
Aug 27, 2025
ContributorAuthor
run external |
yujun777
commented
Aug 27, 2025
ContributorAuthor
run p0 |
1 similar comment
yujun777
commented
Aug 27, 2025
ContributorAuthor
run p0 |
yujun777
commented
Aug 27, 2025
ContributorAuthor
run external |
924060929
approved these changes
Aug 28, 2025
Uh oh!
There was an error while loading. Please reload this page.
github-actionsBot
pushed a commit
that referenced
this pull request
Aug 28, 2025
…r insert value truncate long string (#55325) for below sql: ```sql create table t(a int, b varchar(2)); insert into t values(1, 'abcde'); ``` for doris 2.0, the insert command will throw error 'Insert has filtered data in strict mode', because length of value 'abcde' is bigger than varchar(2). for mysql, pg, the above sql will also throw error for the same reason. for doris version >= 2.1.0, it will not throw error, and just truncate 'abcde' to 'ab'. what's more, for stream load, no matter 2.0, or 2.1, ..., doris will stream load fail. but considering 2.1 have released for 1.5+ year, we don't want to make a behaviour change for 2.1, so add a session variable enable_insert_value_auto_cast, when insert value with longer string value, then will have: - if enable_insert_value_auto_cast = true (default), the longer string will be truncate and insert succ; - if enable_insert_value_auto_cast = false, enable_insert_strict = true(default), will throw exception 'Insert has filtered data in strict mode'; - if enable_insert_value_auto_cast = false, enable_insert_strict = false, then the longer string will be filtered, other rows will insert succ. relate PR: #52802
This was referenced Aug 28, 2025
RoanHeNaN pushed a commit
to RoanHeNaN/doris
that referenced
this pull request
Aug 29, 2025
…r insert value truncate long string (apache#55325) for below sql: ```sql create table t(a int, b varchar(2)); insert into t values(1, 'abcde'); ``` for doris 2.0, the insert command will throw error 'Insert has filtered data in strict mode', because length of value 'abcde' is bigger than varchar(2). for mysql, pg, the above sql will also throw error for the same reason. for doris version >= 2.1.0, it will not throw error, and just truncate 'abcde' to 'ab'. what's more, for stream load, no matter 2.0, or 2.1, ..., doris will stream load fail. but considering 2.1 have released for 1.5+ year, we don't want to make a behaviour change for 2.1, so add a session variable enable_insert_value_auto_cast, when insert value with longer string value, then will have: - if enable_insert_value_auto_cast = true (default), the longer string will be truncate and insert succ; - if enable_insert_value_auto_cast = false, enable_insert_strict = true(default), will throw exception 'Insert has filtered data in strict mode'; - if enable_insert_value_auto_cast = false, enable_insert_strict = false, then the longer string will be filtered, other rows will insert succ. relate PR: apache#52802
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
for below sql:
for doris 2.0, the insert command will throw error 'Insert has filtered data in strict mode', because length of value 'abcde' is bigger than varchar(2).
for mysql, pg, the above sql will also throw error for the same reason.
for doris version >= 2.1.0, it will not throw error, and just truncate 'abcde' to 'ab'.
what's more, for stream load, no matter 2.0, or 2.1, ..., doris will stream load fail.
so doris >= 2.1 may need throw exception for insert value with longer string, but considering 2.1 have released for 1.5+ year, we don't want to make a behaviour change for 2.1, so add a session variable enable_insert_value_auto_cast, when insert value with longer string value, then will have:
relate PR: #52802
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)