This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 1c982d1f4f7 [fix](insert) enable_insert_strict should not affect 
semantic of enable_strict_cast (#63794) (#64267)
1c982d1f4f7 is described below

commit 1c982d1f4f7bd4f60293a1035d3362a7cbf55373
Author: TengJianPing <[email protected]>
AuthorDate: Wed Jun 10 09:34:16 2026 +0800

    [fix](insert) enable_insert_strict should not affect semantic of 
enable_strict_cast (#63794) (#64267)
    
    enable_insert_strict and enable_strict_cast are two independent session
    variables: the former controls how many error rows an insert/load
    tolerates
    (row filtering and the max-filter-ratio), while the latter controls the
    strictness of cast/conversion semantics (whether out-of-range or
    over-length
    values fail vs. are coerced). They were wrongly coupled, and BE
    over-length
    string truncation was driven by the wrong signal:
    
    - FE SessionVariable.enableStrictCast() returned enableInsertStrict
    whenever
    the statement was an insert, so toggling enable_insert_strict silently
    changed cast semantics for inserts and enable_strict_cast had no effect.
    
    This commit decouples the two variables.
    
    None
    
    - Test <!-- At least one of them must be included. -->
        - [x] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
    - [ ] Previous test can cover this change. - [ ] No code files have been
    changed. - [ ] Other reason <!-- Add your reason? -->
    
    - Behavior changed:
        - [ ] No.
        - [x] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [x] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../doris/nereids/rules/analysis/BindSink.java     |   6 +-
 .../java/org/apache/doris/qe/SessionVariable.java  |   4 -
 ..._insert_strict_mode_and_filter_ratio_custom.out |  38 ++
 .../org/apache/doris/regression/suite/Suite.groovy |   5 +
 .../string_len/test_string_len_complex.groovy      |  12 +
 .../import/import-way/insert-into-manual.md.groovy |   1 +
 .../tvf/test_file_tvf_hdfs.groovy                  |   3 +
 .../external_table_p0/tvf/test_hdfs_tvf.groovy     |   3 +
 .../insert_p0/test_error_msg_truncate.groovy       |   1 +
 .../test_streaming_insert_job_alter.groovy         |   6 +-
 .../load/insert/test_array_string_insert.groovy    |   1 +
 .../load_p0/insert/test_insert_statistic.groovy    |   1 +
 ...test_insert_strict_mode_and_filter_ratio.groovy |  20 +-
 ...sert_strict_mode_and_filter_ratio_custom.groovy | 579 +++++++++++++++++++++
 .../load_p0/tvf/test_tvf_error_column.groovy       |   2 +
 .../test_tvf_strict_mode_and_filter_ratio.groovy   |  12 +-
 .../suites/nereids_function_p0/load.groovy         |  13 +-
 .../insert_into_table/insert_values.groovy         |   2 +
 .../schema_change_p0/test_modify_struct.groovy     |   1 +
 .../test_varchar_sc_in_complex.groovy              |   1 +
 20 files changed, 683 insertions(+), 28 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java
index fd501a53c68..9757cbcba2a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java
@@ -338,7 +338,11 @@ public class BindSink implements AnalysisRuleFactory {
                 int targetLength = ((CharacterType) targetType).getLen();
                 if (sourceLength == targetLength) {
                     castExpr = TypeCoercionUtils.castIfNotSameType(castExpr, 
targetType);
-                } else if (truncateString && sourceLength > targetLength && 
targetLength >= 0) {
+                } else if (truncateString && targetLength >= 0
+                        && (sourceLength < 0 || sourceLength > targetLength)) {
+                    // sourceLength < 0 means the source is an unbounded 
string like type
+                    // (e.g. text/string whose getLen() returns -1), which is 
always longer
+                    // than a bounded char/varchar target and therefore needs 
truncation.
                     castExpr = new Substring(castExpr, Literal.of(1), 
Literal.of(targetLength));
                 } else if (targetType.isStringType()) {
                     castExpr = new Cast(castExpr, StringType.INSTANCE);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index d957f19311f..d605c3ad275 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -6315,10 +6315,6 @@ public class SessionVariable implements Serializable, 
Writable {
     public static boolean enableStrictCast() {
         ConnectContext connectContext = ConnectContext.get();
         if (connectContext != null) {
-            StatementContext statementContext = 
connectContext.getStatementContext();
-            if (statementContext != null && statementContext.isInsert()) {
-                return connectContext.getSessionVariable().enableInsertStrict;
-            }
             return connectContext.getSessionVariable().enableStrictCast;
         } else {
             return 
Boolean.parseBoolean(VariableMgr.getDefaultValue("ENABLE_STRICT_CAST"));
diff --git 
a/regression-test/data/load_p0/insert/test_insert_strict_mode_and_filter_ratio_custom.out
 
b/regression-test/data/load_p0/insert/test_insert_strict_mode_and_filter_ratio_custom.out
new file mode 100644
index 00000000000..5dab70ecc02
--- /dev/null
+++ 
b/regression-test/data/load_p0/insert/test_insert_strict_mode_and_filter_ratio_custom.out
@@ -0,0 +1,38 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !insert_values_str_long_than_schema0 --
+1      123
+
+-- !insert_values_str_long_than_schema6 --
+1      123
+
+-- !insert_select_str_long_than_schema2 --
+1      123
+
+-- !insert_select_str_long_than_schema2 --
+1      123
+
+-- !insert_values_invalid_str_to_number0 --
+\N     123
+1      456
+
+-- !insert_values_invalid_str_to_number1 --
+\N     123
+1      456
+
+-- !insert_select_invalid_str_to_number0 --
+0      \N
+1      1
+
+-- !insert_select_invalid_str_to_number1 --
+0      \N
+1      1
+
+-- !insert_select_invalid_str_to_number2 --
+1      1
+
+-- !insert_select_invalid_str_cmp_int --
+0      -9998
+
+-- !insert_select_invalid_str_cmp_int --
+0      -9998
+
diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index fc3811202bd..35ab388dfe8 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -2200,6 +2200,11 @@ class Suite implements GroovyInterceptable {
         }
     }
 
+    void testExpectNoResult(String testSql) {
+        def result = sql(testSql)
+        assertEquals(result.size(), 0)
+    }
+
     void testFoldConst(String foldSql) {
         def sessionVarOrigValue = sql("select @@debug_skip_fold_constant")
         def sqlCacheOrigValue = sql("select @@enable_sql_cache")
diff --git 
a/regression-test/suites/datatype_p0/nested_types/string_len/test_string_len_complex.groovy
 
b/regression-test/suites/datatype_p0/nested_types/string_len/test_string_len_complex.groovy
index 2c5b3d4be17..07b63914fa9 100644
--- 
a/regression-test/suites/datatype_p0/nested_types/string_len/test_string_len_complex.groovy
+++ 
b/regression-test/suites/datatype_p0/nested_types/string_len/test_string_len_complex.groovy
@@ -29,6 +29,7 @@ suite("test_string_len_complex") {
     create_table_array_one_level()
     sql """
     set enable_insert_strict = false;
+    set enable_strict_cast = false;
     """
     sql """
     insert into test_string_len_array_one_level values (1, ['12345678901', 
'12345678902', '12345678903x']),
@@ -40,6 +41,7 @@ suite("test_string_len_complex") {
     create_table_array_one_level()
     sql """
     set enable_insert_strict = true;
+    set enable_strict_cast = true;
     """
     test {
         sql """
@@ -64,6 +66,7 @@ suite("test_string_len_complex") {
     create_table_array_two_level()
     sql """
     set enable_insert_strict = false;
+    set enable_strict_cast = false;
     """
     sql """
     insert into test_string_len_array_two_level values (1, [['12345678901', 
'12345678902'], ['12345678903x']]),
@@ -75,6 +78,7 @@ suite("test_string_len_complex") {
     create_table_array_two_level()
     sql """
     set enable_insert_strict = true;
+    set enable_strict_cast = true;
     """
     test {
         sql """
@@ -99,6 +103,7 @@ suite("test_string_len_complex") {
 
     sql """
     set enable_insert_strict = false;
+    set enable_strict_cast = false;
     """
     create_table_struct_one_level()
     sql """
@@ -108,6 +113,7 @@ suite("test_string_len_complex") {
 
     sql """
     set enable_insert_strict = true;
+    set enable_strict_cast = true;
     """
     create_table_struct_one_level()
     test {
@@ -131,6 +137,7 @@ suite("test_string_len_complex") {
     create_table_struct_two_level()
     sql """
     set enable_insert_strict = false;
+    set enable_strict_cast = false;
     """
     sql """
     insert into test_string_len_struct_two_level values (1, {'12345678901', 
{'12345678902', '12345678903'}}),
@@ -142,6 +149,7 @@ suite("test_string_len_complex") {
     create_table_struct_two_level()
     sql """
     set enable_insert_strict = true;
+    set enable_strict_cast = true;
     """
     test {
         sql """
@@ -168,6 +176,7 @@ suite("test_string_len_complex") {
     create_table_map_one_level()
     sql """
     set enable_insert_strict = false;
+    set enable_strict_cast = false;
     """
     sql """
     insert into test_string_len_map_one_level values (1, 
{'01234567891':'12345678901', '01234567892':'12345678902'}), 
@@ -179,6 +188,7 @@ suite("test_string_len_complex") {
     create_table_map_one_level()
     sql """
     set enable_insert_strict = true;
+    set enable_strict_cast = true;
     """
     test {
         sql """
@@ -204,6 +214,7 @@ suite("test_string_len_complex") {
     create_table_map_two_level()
     sql """
     set enable_insert_strict = false;
+    set enable_strict_cast = false;
     """
     sql """
     insert into test_string_len_map_two_level values (1, { 
{'01234567891':'12345678901'}:{'11234567891':'12345678901'}, 
{'01234567892':'12345678902'}:{'11234567892':'12345678902'} } ), 
@@ -215,6 +226,7 @@ suite("test_string_len_complex") {
     create_table_map_two_level()
     sql """
     set enable_insert_strict = true;
+    set enable_strict_cast = true;
     """
     test {
         sql """
diff --git 
a/regression-test/suites/doc/data-operate/import/import-way/insert-into-manual.md.groovy
 
b/regression-test/suites/doc/data-operate/import/import-way/insert-into-manual.md.groovy
index 625d66f4682..5708929eb56 100644
--- 
a/regression-test/suites/doc/data-operate/import/import-way/insert-into-manual.md.groovy
+++ 
b/regression-test/suites/doc/data-operate/import/import-way/insert-into-manual.md.groovy
@@ -79,6 +79,7 @@ 
suite("docs/data-operate/import/import-way/insert-into-manual.md") {
         if (!isCloudMode()) {
             // skip this case if this is a cloud cluster
             try {
+                sql "set enable_strict_cast = true;"
                 sql "INSERT INTO tbl1 SELECT LPAD('foo', 100, 'bar');"
                 Assertions.fail("this sql should fail, because we want get err 
url ")
             } catch (Exception e) {
diff --git 
a/regression-test/suites/external_table_p0/tvf/test_file_tvf_hdfs.groovy 
b/regression-test/suites/external_table_p0/tvf/test_file_tvf_hdfs.groovy
index 79899098f11..90e18b16b65 100644
--- a/regression-test/suites/external_table_p0/tvf/test_file_tvf_hdfs.groovy
+++ b/regression-test/suites/external_table_p0/tvf/test_file_tvf_hdfs.groovy
@@ -244,6 +244,7 @@ 
suite("test_file_tvf_hdfs","external,hive,tvf,external_docker") {
             format = "json"
 
             sql "set enable_insert_strict=false;"
+            sql "set enable_strict_cast=false;"
             sql "set insert_max_filter_ratio=0.2;"
             def result2 = sql """ insert into ${testTable}(id,city,code)
                     select cast (id as INT) as id, city, cast (code as INT) as 
code
@@ -259,6 +260,7 @@ 
suite("test_file_tvf_hdfs","external,hive,tvf,external_docker") {
 
             try{
                 sql "set enable_insert_strict=true;"
+                sql "set enable_strict_cast=true;"
                 sql "set insert_max_filter_ratio=0.1;"
                 def result3 = sql """ insert into ${testTable}(id,city,code)
                         select cast (id as INT) as id, city, cast (code as 
INT) as code
@@ -277,6 +279,7 @@ 
suite("test_file_tvf_hdfs","external,hive,tvf,external_docker") {
 
             try{
                 sql " set enable_insert_strict=true;"
+                sql "set enable_strict_cast=true;"
                 def result4 = sql """ insert into ${testTable}(id,city,code)
                         select cast (id as INT) as id, city, cast (code as 
INT) as code
                         from FILE(
diff --git a/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy 
b/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy
index 932802091d1..63cd4fec2ea 100644
--- a/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy
+++ b/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy
@@ -253,6 +253,7 @@ suite("test_hdfs_tvf","external,hive,tvf,external_docker") {
             format = "json"
 
             sql "set enable_insert_strict=false;"
+            sql "set enable_strict_cast=false;"
             sql "set insert_max_filter_ratio=0.2;"
             def result2 = sql """ insert into ${testTable}(id,city,code)
                     select cast (id as INT) as id, city, cast (code as INT) as 
code
@@ -268,6 +269,7 @@ suite("test_hdfs_tvf","external,hive,tvf,external_docker") {
 
             try{
                 sql "set enable_insert_strict=true;"
+                sql "set enable_strict_cast=true;"
                 sql "set insert_max_filter_ratio=0.1;"
                 def result3 = sql """ insert into ${testTable}(id,city,code)
                         select cast (id as INT) as id, city, cast (code as 
INT) as code
@@ -286,6 +288,7 @@ suite("test_hdfs_tvf","external,hive,tvf,external_docker") {
 
             try{
                 sql " set enable_insert_strict=true;"
+                sql "set enable_strict_cast=true;"
                 def result4 = sql """ insert into ${testTable}(id,city,code)
                         select cast (id as INT) as id, city, cast (code as 
INT) as code
                         from HDFS(
diff --git a/regression-test/suites/insert_p0/test_error_msg_truncate.groovy 
b/regression-test/suites/insert_p0/test_error_msg_truncate.groovy
index df0e2e44497..f70ba4d1e8f 100644
--- a/regression-test/suites/insert_p0/test_error_msg_truncate.groovy
+++ b/regression-test/suites/insert_p0/test_error_msg_truncate.groovy
@@ -34,6 +34,7 @@ suite("test_error_msg_truncate","nonConcurrent") {
         GetDebugPoint().enableDebugPointForAllFEs("TestErrorMsgTruncate")
         
         def hasException = false
+        sql "set enable_insert_value_auto_cast=false"
         try {
             sql """
                 INSERT INTO ${tableName} VALUES (1, 
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
diff --git 
a/regression-test/suites/job_p0/streaming_job/test_streaming_insert_job_alter.groovy
 
b/regression-test/suites/job_p0/streaming_job/test_streaming_insert_job_alter.groovy
index aa7fbea124b..c2b263bc4c0 100644
--- 
a/regression-test/suites/job_p0/streaming_job/test_streaming_insert_job_alter.groovy
+++ 
b/regression-test/suites/job_p0/streaming_job/test_streaming_insert_job_alter.groovy
@@ -42,6 +42,9 @@ suite("test_streaming_insert_job_alter") {
     // Create a job, let it have data quality errors, modify the schema, and 
resume it
     sql """
        CREATE JOB ${jobName}  
+       PROPERTIES (
+            "session.enable_strict_cast" = true
+       )
        ON STREAMING DO INSERT INTO ${tableName} 
        SELECT * FROM S3
         (
@@ -85,6 +88,7 @@ suite("test_streaming_insert_job_alter") {
        ALTER JOB ${jobName}
        PROPERTIES(
         "session.enable_insert_strict" = false,
+        "session.enable_strict_cast" = false,
         "session.insert_max_filter_ratio" = 1
        )
         """
@@ -93,7 +97,7 @@ suite("test_streaming_insert_job_alter") {
         select status,properties from jobs("type"="insert") where 
Name='${jobName}'
     """
     assert alterJobProperties.get(0).get(0) == "PAUSED"
-    assert alterJobProperties.get(0).get(1) == 
"{\"session.enable_insert_strict\":\"false\",\"session.insert_max_filter_ratio\":\"1\"}"
+    assert alterJobProperties.get(0).get(1) == 
"{\"session.enable_strict_cast\":\"false\",\"session.enable_insert_strict\":\"false\",\"session.insert_max_filter_ratio\":\"1\"}"
 
     // modify column c2 to varchar(3), Exceeding the limit will be 
automatically truncated
     sql """
diff --git a/regression-test/suites/load/insert/test_array_string_insert.groovy 
b/regression-test/suites/load/insert/test_array_string_insert.groovy
index fd8e3ab1fa8..6e6252b1a63 100644
--- a/regression-test/suites/load/insert/test_array_string_insert.groovy
+++ b/regression-test/suites/load/insert/test_array_string_insert.groovy
@@ -49,6 +49,7 @@ suite("test_array_string_insert", "load") {
 
         // ARRAY<char> too long
         def exception_str = isGroupCommitMode() ? "too many filtered rows" : 
"Insert has filtered data in strict mode"
+        sql "set enable_strict_cast = true"
         test {
             sql "INSERT INTO ${testTable} VALUES (1, ['12345','123456'], [], 
NULL)"
             exception exception_str
diff --git a/regression-test/suites/load_p0/insert/test_insert_statistic.groovy 
b/regression-test/suites/load_p0/insert/test_insert_statistic.groovy
index 62e8201f00f..ffc1263b5f4 100644
--- a/regression-test/suites/load_p0/insert/test_insert_statistic.groovy
+++ b/regression-test/suites/load_p0/insert/test_insert_statistic.groovy
@@ -98,6 +98,7 @@ suite("test_insert_statistic", "p0") {
      PROPERTIES ("replication_num"="1");
     """
     sql """ set enable_insert_strict = true """
+    sql """ set enable_strict_cast = true """
     try {
         sql """ INSERT INTO ${insert_tbl}_fail SELECT 
'this_value_is_too_long_for_varchar3' """
     } catch (Exception e) {
diff --git 
a/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio.groovy
 
b/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio.groovy
index 5fc9a00d086..09c2df8f01f 100644
--- 
a/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio.groovy
+++ 
b/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio.groovy
@@ -27,7 +27,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
     PROPERTIES ("replication_num" = "1");
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0"
     sql """
         INSERT INTO test_insert_strict_mode_and_filter_ratio VALUES 
@@ -49,7 +49,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         truncate table test_insert_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
         sql """
@@ -80,7 +80,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
     PROPERTIES ("replication_num" = "1");
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0"
     sql """
         INSERT INTO test_insert_strict_mode_and_filter_ratio VALUES 
@@ -102,7 +102,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         truncate TABLE test_insert_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
         sql """
@@ -135,7 +135,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
     PROPERTIES ("replication_num" = "1");
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0.2"
     test {
         sql """
@@ -183,7 +183,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         truncate TABLE test_insert_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0.3"
     sql """
         INSERT INTO test_insert_strict_mode_and_filter_ratio VALUES 
@@ -223,7 +223,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         truncate TABLE test_insert_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
         sql """
@@ -364,7 +364,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         ) properties ('replication_num' = '1');
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0"
     sql """
     insert into test_insert_strict_mode_and_filter_ratio  values
@@ -386,7 +386,7 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         truncate table test_insert_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
         sql """
@@ -484,4 +484,4 @@ suite("test_insert_strict_mode_and_filter_ratio","p0") {
         exception """Insert has filtered data in strict mode"""
     }
     qt_sql_mb_string_exceed_len_strict0 "select * from 
test_insert_strict_mode_and_filter_ratio order by 1"
-}
\ No newline at end of file
+}
diff --git 
a/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio_custom.groovy
 
b/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio_custom.groovy
new file mode 100644
index 00000000000..44289dc36e9
--- /dev/null
+++ 
b/regression-test/suites/load_p0/insert/test_insert_strict_mode_and_filter_ratio_custom.groovy
@@ -0,0 +1,579 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_insert_strict_mode_and_filter_ratio_custom","p0") {
+    multi_sql """
+        drop table if exists test_src;
+        drop table if exists test_dst;
+        drop table if exists test_dst_not_null;
+        drop table if exists test_dst_int;
+        drop table if exists test_dst_int_not_null;
+
+        create table test_src(f1 int, f2 char(6)) properties('replication_num' 
= '1');
+        create table test_dst(f1 int, f2 char(3)) properties('replication_num' 
= '1');
+        create table test_dst_not_null(f1 int not null, f2 char(3) not null) 
properties('replication_num' = '1');
+        create table test_dst_int(f1 int, f2 int) properties('replication_num' 
= '1');
+        create table test_dst_int_not_null(f1 int not null, f2 int not null) 
properties('replication_num' = '1');
+    """
+    def enableAutoSubStringForInsert = {
+        multi_sql """
+            set enable_insert_value_auto_cast = false;
+            set enable_strict_cast = false;
+        """
+    }
+    sql """
+        set insert_max_filter_ratio = 1;
+    """
+
+    // For insert statements, if enable_insert_value_auto_cast = true && 
enable_strict_cast = false
+    // FE will plan substring for string value whose length is longer than 
schema,
+    // and insert truncated string, no matter enable_insert_strict is true or 
false.
+
+    // test 1: INSERT INTO VALUES, str length is longer than schema, 
enable_insert_strict=true.
+    sql """
+        set enable_insert_strict=true;
+     """
+    // test 1.1: insert strict, NO auto cast, NO strict cast, plan no substr, 
should failed
+    sql """
+        set enable_insert_value_auto_cast = false;
+    """
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set enable_strict_cast = false;
+    """
+    test {
+        sql """
+        insert into test_dst values(1, '123456');
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    // test 1.2: insert strict, NO auto cast, WITH strict cast, plan no 
substr, should failed
+    multi_sql """
+        set enable_strict_cast = true;
+    """
+    test {
+        sql """
+            insert into test_dst values(1, '123456');
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    // test 1.3: insert strict, WITH auto cast, no strict cast, plan substr, 
insert truncated str
+    sql """
+        set enable_insert_value_auto_cast = true;
+    """
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        insert into test_dst values(1, '123456');
+    """
+    order_qt_insert_values_str_long_than_schema0 """
+        select * from test_dst;
+    """
+    // test 1.4: insert strict, WITH auto cast, WITH strict cast, plan NO 
substr, should fail
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set enable_strict_cast = true;
+    """
+    test {
+        sql """
+        insert into test_dst values(1, '123456');
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+    // end test 1: insert into values, str length is longer than schema, 
enable_insert_strict=true.
+
+    /*
+    Currently when enable_insert_strict=false, BE do substring for string 
value whose length is longer than schema,
+    and insert truncated string, no matter enable_insert_value_auto_cast and 
enable_strict_cast is true or false.
+    So insert_max_filter_ratio does not affect whether insert succeed or fail.
+    // test 2: INSERT INTO VALUES, str length is longer than schema, 
enable_insert_strict=false
+    // insert_max_filter_ratio affect whether insert succeed or fail
+    sql """
+        set enable_insert_strict=false;
+    """
+    // test 2.1: NOT insert strict, NO auto cast, NO strict cast, plan no 
substr
+    multi_sql """
+        set enable_insert_value_auto_cast = false;
+        set enable_strict_cast = false;
+    """
+    // insert_max_filter_ratio = 0, fail
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set insert_max_filter_ratio = 0;
+    """
+    test {
+        sql """
+        insert into test_dst values(1, '123456');
+        """
+        exception """Insert has too many filtered data"""
+    }
+    testExpectNoResult("select * from test_dst;")
+    // insert_max_filter_ratio = 1, OK, no data is inserted
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set insert_max_filter_ratio = 1;
+    """
+    sql """
+        insert into test_dst values(1, '123456');
+    """
+    testExpectNoResult("select * from test_dst;")
+    // test 2.2: NOT insert strict, NO auto cast, WITH strict cast, plan no 
substr
+    sql """
+        set enable_strict_cast = true;
+    """
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set insert_max_filter_ratio = 0.5;
+    """
+    test {
+        sql """
+            insert into test_dst values(1, '123456');
+        """
+        exception """Insert has too many filtered data"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    multi_sql """
+        set insert_max_filter_ratio = 1;
+    """
+    sql """
+        insert into test_dst values(1, '123456');
+    """
+    testExpectNoResult("select * from test_dst;")
+    // test 2.3: NOT insert strict, WITH auto cast, NO strict cast, plan 
substr, insert OK
+    sql """
+        set enable_insert_value_auto_cast = true;
+    """
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0;
+    """
+    sql """
+        insert into test_dst values(1, '123456');
+    """
+    order_qt_insert_values_str_long_than_schema6 """
+        select * from test_dst;
+    """
+
+    // test 2.4: NOT insert strict, WITH auto cast, WITH strict cast, plan no 
substr
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 0.5;
+    """
+    test {
+        sql """
+            insert into test_dst values(1, '123456');
+        """
+        exception """Insert has too many filtered data"""
+    }
+    testExpectNoResult("select * from test_dst;")
+    // insert_max_filter_ratio = 1;
+    multi_sql """
+        set insert_max_filter_ratio = 1;
+        insert into test_dst values(1, '123456');
+    """
+    testExpectNoResult("select * from test_dst;")
+    // END test 2: insert into values, str length is longer than schema, 
enable_insert_strict=false,
+    */
+
+    // test 3: INSERT INTO SELECT, str length is longer than schema, 
enable_insert_strict=true
+    multi_sql """
+        set enable_insert_strict=true;
+        set insert_max_filter_ratio = 1;
+    """
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst;
+        insert into test_src values(1, '123456');
+    """
+    // test 3.1: insert strict ON, auto cast OFF, strict cast OFF, plan no 
substr, should failed
+    multi_sql """
+        truncate table test_dst;
+        set enable_insert_value_auto_cast = false;
+        set enable_strict_cast = false;
+    """
+    test {
+        sql """
+        insert into test_dst select * from test_src;
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+    
+    // test 3.2: insert strict ON, auto cast OFF, strict cast ON, plan no 
substr, should failed
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = true;
+    """
+    test {
+        sql """
+            insert into test_dst select * from test_src;
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    // test 3.3: insert strict ON, auto cast ON,  strict cast OFF, plan 
substr, insert truncated str
+    sql """
+        set enable_insert_value_auto_cast = true;
+    """
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        insert into test_dst select * from test_src;
+    """
+    order_qt_insert_select_str_long_than_schema2 """
+        select * from test_dst;
+    """
+    // test 3.4: insert strict ON, auto cast ON, strict cast ON, plan NO 
substr, should fail
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = true;
+    """
+    test {
+        sql """
+        insert into test_dst select * from test_src;
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+    // END test 3: insert into select, str length is longer than schema, 
enable_insert_strict=true
+
+    /*
+    // test 4: INSERT INTO SELECT, str length is longer than schema, 
enable_insert_strict=false
+    // test 4.5: insert strict OFF, auto cast OFF, strict cast OFF, plan no 
substr, should failed
+    multi_sql """
+        set enable_insert_strict=false;
+        set enable_insert_value_auto_cast = false;
+    """
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0.5;
+    """
+    test {
+        sql """
+        insert into test_dst select * from test_src;
+        """
+        exception """Insert has too many filtered data"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    // insert_max_filter_ratio = 1, should be OK, no data is inserted
+    sql """
+        set insert_max_filter_ratio = 1;
+    """
+    sql """
+    insert into test_dst select * from test_src;
+    """
+    testExpectNoResult("select * from test_dst;")
+    
+    // test 4.2: insert strict OFF, auto cast OFF, strict cast ON, plan no 
substr, should failed
+    multi_sql """
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 0.5;
+    """
+    test {
+        sql """
+            insert into test_dst select * from test_src;
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    // insert_max_filter_ratio = 1, should be OK, no data is inserted
+    sql """
+        set insert_max_filter_ratio = 1;
+    """
+    sql """
+    insert into test_dst select * from test_src;
+    """
+    testExpectNoResult("select * from test_dst;")
+
+    // test 4.3: insert strict OFF, auto cast ON, strict cast OFF, plan 
substr, insert truncated str
+    sql """
+        set enable_insert_value_auto_cast = true;
+        set insert_max_filter_ratio = 0;
+    """
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        insert into test_dst select * from test_src;
+    """
+    order_qt_insert_select_str_long_than_schema2 """
+        select * from test_dst;
+    """
+    // test 4.4: insert strict OFF, auto cast ON, strict cast ON, plan NO 
substr, should fail
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 0.5;
+    """
+    test {
+        sql """
+            insert into test_dst select * from test_src;
+        """
+        exception """the length of input is too long than schema"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    multi_sql """
+        set insert_max_filter_ratio = 1;
+    """
+    sql """
+        insert into test_dst select * from test_src;
+    """
+    testExpectNoResult("select * from test_dst;")
+    // END test 4: insert into select, str length is longer than schema, 
enable_insert_strict=true
+    */
+
+    // test 5: insert into values, invalid string to number, 
enable_insert_strict=true
+    multi_sql """
+        set enable_insert_strict=true;
+    """
+    // test 5.1: insert strict ON, strict cast OFF, cast to NULL, NULL is 
inserted
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0;
+    """
+    sql """
+        insert into test_dst values('NA', '123'), ("1", "456");
+    """
+    order_qt_insert_values_invalid_str_to_number0 """
+        select * from test_dst;
+    """
+
+    // test 5.2: insert strict ON, strict cast ON
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 1;
+    """
+    test {
+        sql """
+            insert into test_dst values('NA', '123'), ("1", "456");
+        """
+        exception """can't cast"""
+    }
+    testExpectNoResult("select * from test_dst;")
+
+    // test 5.3: insert strict ON, strict cast OFF, insert into not nullable, 
cast to NULL, should fail even insert_max_filter_ratio = 1, because NULL can't 
be inserted into not nullable column
+    multi_sql """
+        truncate table test_dst_not_null;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 1;
+    """
+    test {
+        sql """
+            insert into test_dst_not_null values('NA', '123'), ("1", "456");
+        """
+        exception """null value for not null column"""
+    }
+    testExpectNoResult("select * from test_dst_not_null;")
+    // END test 5: insert into values, invalid string to number, 
enable_insert_strict=true
+
+    // test 6: insert into values, invalid string to number, 
enable_insert_strict=false
+    multi_sql """
+        set enable_insert_strict=false;
+    """
+    // test 6.1: insert strict OFF, strict cast OFF, cast to NULL, NULL is 
inserted
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0;
+    """
+    sql """
+        insert into test_dst values('NA', '123'), ("1", "456");
+    """
+    order_qt_insert_values_invalid_str_to_number1 """
+        select * from test_dst;
+    """
+    // test 6.2: insert strict OFF, strict cast ON, cast fail
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 1;
+    """
+    test {
+        sql """
+            insert into test_dst values('NA', '123'), ("1", "456");
+        """
+        exception """can't cast"""
+    }
+    testExpectNoResult("select * from test_dst;")
+    // END test 6: insert into values, invalid string to number, 
enable_insert_strict=false
+
+    // test 7: insert into select, invalid string to number, 
enable_insert_strict=true
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst_int;
+        set enable_insert_strict=true;
+        insert into test_src values(0, 'NA'), (1, '1');
+    """
+    // test 7.1: insert strict ON, strict cast OFF, cast to NULL, NULL is 
inserted
+    multi_sql """
+        truncate table test_dst_int;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0;
+    """
+    sql """
+        insert into test_dst_int select * from test_src;
+    """
+    order_qt_insert_select_invalid_str_to_number0 """
+        select * from test_dst_int;
+    """
+    // test 7.2: insert strict ON, strict cast ON
+    multi_sql """
+        truncate table test_dst_int;
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 1;
+    """
+    test {
+        sql """
+            insert into test_dst_int select * from test_src;
+        """
+        exception """parse number fail"""
+    }
+    testExpectNoResult("select * from test_dst_int;")
+
+    // test 7.3: insert strict ON, strict cast OFF, insert into not nullable, 
cast to NULL, should fail even insert_max_filter_ratio = 1, because NULL can't 
be inserted into not nullable column
+    multi_sql """
+        truncate table test_dst_int_not_null;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 1;
+    """
+    test {
+        sql """
+            insert into test_dst_int_not_null select * from test_src;
+        """
+        exception """null value for not null column"""
+    }
+    testExpectNoResult("select * from test_dst_int_not_null;")
+    // END test 7: insert into select, invalid string to number, 
enable_insert_strict=true
+
+    // test 8: insert into select, invalid string to number, 
enable_insert_strict=false
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst_int;
+        set enable_insert_strict=false;
+        insert into test_src values(0, 'NA'), (1, '1');
+    """
+    // test 8.1: insert strict OFF, strict cast OFF, cast to NULL, NULL is 
inserted
+    multi_sql """
+        truncate table test_dst;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0;
+    """
+    sql """
+        insert into test_dst_int select * from test_src;
+    """
+    order_qt_insert_select_invalid_str_to_number1 """
+        select * from test_dst_int;
+    """
+    // test 8.2: insert strict OFF, strict cast ON, cast fail
+    multi_sql """
+        truncate table test_dst_int;
+        set enable_strict_cast = true;
+        set insert_max_filter_ratio = 1;
+    """
+    test {
+        sql """
+            insert into test_dst_int select * from test_src;
+        """
+        exception """parse number fail"""
+    }
+    testExpectNoResult("select * from test_dst_int;")
+    // test 8.3: insert strict OFF, strict cast OFF, insert into not nullable, 
cast to NULL, should fail even insert_max_filter_ratio = 1, because NULL can't 
be inserted into not nullable column
+    multi_sql """
+        truncate table test_dst_int_not_null;
+        set enable_strict_cast = false;
+        set insert_max_filter_ratio = 0.4;
+    """
+    test {
+        sql """
+            insert into test_dst_int_not_null select * from test_src;
+        """
+        exception """null value for not null column"""
+    }
+    testExpectNoResult("select * from test_dst_int_not_null;")
+
+    multi_sql """
+        set insert_max_filter_ratio = 1;
+    """
+    sql """
+        insert into test_dst_int_not_null select * from test_src;
+    """
+    order_qt_insert_select_invalid_str_to_number2 """
+        select * from test_dst_int_not_null;
+    """
+    // END test 8: insert into select, invalid string to number, 
enable_insert_strict=false
+
+    // test 9: str == int, invalid string to number, enable_insert_strict=true
+    multi_sql """
+        truncate table test_src;
+        truncate table test_dst_int;
+        set insert_max_filter_ratio = 0;
+        insert into test_src values(0, 'NA'), (0, '1');
+    """
+    def testInvalidStrCmpInt = { bEnableInsertStrict ->
+        // test 9.1: strict cast ON, cast fail
+        multi_sql """
+            truncate table test_dst_int;
+            set enable_insert_strict = ${bEnableInsertStrict};
+            set enable_strict_cast = true;
+            set insert_max_filter_ratio = 1;
+        """
+        test {
+            sql """
+                insert into test_dst_int select f1, sum(if(f2 = 1, f2, -9999)) 
from test_src group by f1;
+            """
+            exception """parse number fail"""
+        }
+        testExpectNoResult("select * from test_dst_int;")
+
+        // test 9.2: strict cast OFF, should be OK, invalid string is cast to 
NULL, sum result is -9998
+        multi_sql """
+            set enable_strict_cast = false;
+        """
+        sql """
+            insert into test_dst_int select f1, sum(if(f2 = 1, f2, -9999)) 
from test_src group by f1;
+        """
+        order_qt_insert_select_invalid_str_cmp_int """
+            select * from test_dst_int;
+        """
+    }
+    testInvalidStrCmpInt(true)
+    testInvalidStrCmpInt(false)
+    // END test 9: str == int, invalid string to number
+}
+
diff --git a/regression-test/suites/load_p0/tvf/test_tvf_error_column.groovy 
b/regression-test/suites/load_p0/tvf/test_tvf_error_column.groovy
index 83499fc0dc2..22c2a8a644e 100644
--- a/regression-test/suites/load_p0/tvf/test_tvf_error_column.groovy
+++ b/regression-test/suites/load_p0/tvf/test_tvf_error_column.groovy
@@ -40,6 +40,7 @@ suite("test_tvf_error_column", "p0") {
         PROPERTIES ("replication_allocation" = "tag.location.default: 1");
     """
 
+    sql "set enable_insert_value_auto_cast=false"
     // Step1: date length  overflow
     test {
         sql """       
@@ -59,6 +60,7 @@ suite("test_tvf_error_column", "p0") {
 
 
     // Step2: column with wrong type 
+    sql "set enable_strict_cast=true"
     test {
         sql """       
                 INSERT INTO ${tableName}
diff --git 
a/regression-test/suites/load_p0/tvf/test_tvf_strict_mode_and_filter_ratio.groovy
 
b/regression-test/suites/load_p0/tvf/test_tvf_strict_mode_and_filter_ratio.groovy
index 3bb06993cb4..131fb7f575c 100644
--- 
a/regression-test/suites/load_p0/tvf/test_tvf_strict_mode_and_filter_ratio.groovy
+++ 
b/regression-test/suites/load_p0/tvf/test_tvf_strict_mode_and_filter_ratio.groovy
@@ -35,7 +35,7 @@ suite("test_tvf_strict_mode_and_filter_ratio", "p0") {
     PROPERTIES ("replication_num" = "1");
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0"
     sql """ insert into test_insert_select_tvf_strict_mode_and_filter_ratio 
SELECT * FROM S3 (
                             "uri" = 
"http://${bucket}.${s3_endpoint}/${path}/${csvFile}";,
@@ -53,7 +53,7 @@ suite("test_tvf_strict_mode_and_filter_ratio", "p0") {
        truncate TABLE test_insert_select_tvf_strict_mode_and_filter_ratio;
 """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
        sql """ insert into test_insert_select_tvf_strict_mode_and_filter_ratio 
SELECT * FROM S3 (
@@ -81,7 +81,7 @@ suite("test_tvf_strict_mode_and_filter_ratio", "p0") {
     PROPERTIES ("replication_num" = "1");
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0"
     sql """ insert into test_insert_select_tvf_strict_mode_and_filter_ratio 
SELECT * FROM S3 (
                             "uri" = 
"http://${bucket}.${s3_endpoint}/${path}/${csvFile}";,
@@ -99,7 +99,7 @@ suite("test_tvf_strict_mode_and_filter_ratio", "p0") {
         truncate TABLE test_insert_select_tvf_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
        sql """ insert into test_insert_select_tvf_strict_mode_and_filter_ratio 
SELECT * FROM S3 (
@@ -274,7 +274,7 @@ suite("test_tvf_strict_mode_and_filter_ratio", "p0") {
         ) properties ('replication_num' = '1');
     """
     sql "set enable_insert_strict=false"
-    sql "set enable_strict_cast=true"
+    sql "set enable_strict_cast=false"
     sql "set insert_max_filter_ratio=0"
     sql """ insert into test_insert_select_tvf_strict_mode_and_filter_ratio 
SELECT * FROM S3 (
                             "uri" = 
"http://${bucket}.${s3_endpoint}/${path}/${csvFile}";,
@@ -292,7 +292,7 @@ suite("test_tvf_strict_mode_and_filter_ratio", "p0") {
         truncate table test_insert_select_tvf_strict_mode_and_filter_ratio;
     """
     sql "set enable_insert_strict=true"
-    sql "set enable_strict_cast=false"
+    sql "set enable_strict_cast=true"
     sql "set insert_max_filter_ratio=1"
     test {
        sql """ insert into test_insert_select_tvf_strict_mode_and_filter_ratio 
SELECT * FROM S3 (
diff --git a/regression-test/suites/nereids_function_p0/load.groovy 
b/regression-test/suites/nereids_function_p0/load.groovy
index 08eb390f422..edbe3157333 100644
--- a/regression-test/suites/nereids_function_p0/load.groovy
+++ b/regression-test/suites/nereids_function_p0/load.groovy
@@ -19,6 +19,11 @@ import org.apache.commons.io.FileUtils
 
 suite("load") {
 
+
+    multi_sql """
+        set enable_insert_strict = true;
+        set enable_strict_cast = false;
+    """
     // ddl begin
     sql "drop table if exists fn_test"
     sql "drop table if exists fn_test_not_nullable"
@@ -159,13 +164,11 @@ suite("load") {
 
     if (!isClusterKeyEnabled()) {
     // test fn_test_ip_nullable_rowstore table with update action
-    sql "set enable_insert_strict = false;"
     sql "update fn_test_ip_nullable_rowstore set ip4 = '' where id = 1;"
     sql_res = sql "select * from fn_test_ip_nullable_rowstore where id = 1;"
     log.info("sql_res: ${sql_res[0]}".toString())
     assertEquals(sql_res[0].toString(), '[1, null, ::1, "127.0.0.1", "::1"]')
     sql "update fn_test_ip_nullable_rowstore set ip6 = '' where id = 1;"
-    sql "set enable_insert_strict = true;"
     sql_res = sql "select * from fn_test_ip_nullable_rowstore where id = 1;"
     assertEquals(sql_res[0].toString(), '[1, null, null, "127.0.0.1", "::1"]')
     sql "update fn_test_ip_nullable_rowstore set ip4 = '127.0.0.1' where id = 
1;"
@@ -232,12 +235,12 @@ suite("load") {
     // not null will throw exception if we has data in table
     test {
         sql "update fn_test_ip_not_nullable_rowstore set ip4 = '' where id = 
1;"
-        exception("parse ipv4 fail")
+        exception("null value for not null column")
     }
 
     test {
         sql "update fn_test_ip_not_nullable_rowstore set ip6 = '' where id = 
1;"
-        exception("parse ipv6 fail")
+        exception("null value for not null column")
     }
     sql """
     set debug_skip_fold_constant=false;
@@ -746,9 +749,7 @@ suite("load") {
             }
             insert_sql += ")"
             log.info("insert_sql: ${insert_sql}".toString())
-            sql "set enable_insert_strict = false"
             sql insert_sql
-            sql "set enable_insert_strict = true"
             row_cnt ++
         }
     }
diff --git 
a/regression-test/suites/nereids_p0/insert_into_table/insert_values.groovy 
b/regression-test/suites/nereids_p0/insert_into_table/insert_values.groovy
index d4ab5c227da..90153eb12d3 100644
--- a/regression-test/suites/nereids_p0/insert_into_table/insert_values.groovy
+++ b/regression-test/suites/nereids_p0/insert_into_table/insert_values.groovy
@@ -191,6 +191,8 @@ suite('nereids_insert_into_values') {
 
     // when disable insert strict, the longer varchar row will be truncated 
and inserted
     sql 'set enable_insert_strict = false'
+    sql "set enable_strict_cast = false"
+    sql 'set enable_insert_value_auto_cast = true'
     sql "insert into test_insert_more_string values (5, 'o'), (6, 'pqrst')"
 
     order_qt_select_test_insert_more_string "select * from 
test_insert_more_string"
diff --git a/regression-test/suites/schema_change_p0/test_modify_struct.groovy 
b/regression-test/suites/schema_change_p0/test_modify_struct.groovy
index 1f865f919cd..12effd00a15 100644
--- a/regression-test/suites/schema_change_p0/test_modify_struct.groovy
+++ b/regression-test/suites/schema_change_p0/test_modify_struct.groovy
@@ -90,6 +90,7 @@ suite ("test_modify_struct") {
                     (1, 14.9, named_struct('col','commiter'), 
named_struct('col','amory'));
                 """
             // more than 10 characters
+            sql "set enable_strict_cast = true"
             test {
                 sql """ insert into $tableName values
                     (11, 111.111, named_struct('col','commiter'), 
named_struct('col','amoryIsBetter'));
diff --git 
a/regression-test/suites/schema_change_p0/test_varchar_sc_in_complex.groovy 
b/regression-test/suites/schema_change_p0/test_varchar_sc_in_complex.groovy
index 316b6f73d6d..90921cf0dc6 100644
--- a/regression-test/suites/schema_change_p0/test_varchar_sc_in_complex.groovy
+++ b/regression-test/suites/schema_change_p0/test_varchar_sc_in_complex.groovy
@@ -53,6 +53,7 @@ suite ("test_varchar_sc_in_complex") {
             """
         // this can be insert but with cut off the left string to 10
         def exception_str = isGroupCommitMode() ? "too many filtered rows" : 
"Insert has filtered data in strict mode"
+        sql "set enable_strict_cast = true"
         test {
             sql """ insert into ${tableName} values
                 (11, ['2025-01-03-22-33'], 
{'doris111111111':'better2222222222'}, named_struct('col','amoryIsBetter'));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to