francisoliverlee opened a new issue #5447:
URL: https://github.com/apache/incubator-doris/issues/5447


   **Describe the bug**
   ```
   ERROR 5012 (HY000): errCode = 2, detailMessage = Unexpected exception: 
Failed analysis after expr substitution.
   ```
   
   **To Reproduce**
   - prepare doris tables
     ```sql
     create database test;
     use test;
   
     CREATE TABLE `dp_class_student_test` (
       `teacher_region` int(11) NULL COMMENT ""
     ) ENGINE=OLAP
     COMMENT ""
     DISTRIBUTED BY HASH(`teacher_region`) BUCKETS 1
     PROPERTIES (
         "replication_num" = "1",
         "in_memory" = "false",
         "storage_format" = "DEFAULT"
     );
     
     insert into test.dp_class_student_test(teacher_region) values(1);
     insert into test.dp_class_student_test(teacher_region) values(2);
     insert into test.dp_class_student_test(teacher_region) values(3);
     ```
   - exec sql to reproduce the EXCEPTION
     ```sql
     select
         distinct teacher_region
     from
         (
             select
                 teacher_region
             from
                 test.dp_class_student_test
             union all
             select
                 '全国' as teacher_region
             from
                 test.dp_class_student_test
         ) as aaa
     where teacher_region in ('1', '全国')
     ```
   - find out where problem is
     - sql can run right
       ```sql
       select
           distinct teacher_region
       from
           (
               select
                   teacher_region
               from
                   test.dp_class_student_test
               union all
               select
                   '全国' as teacher_region
               from
                   test.dp_class_student_test
           ) as aaa
       where teacher_region in ('1');
       ```
     - sql cannot run
       ```sql
       select
           distinct teacher_region
       from
           (
               select
                   teacher_region
               from
                   test.dp_class_student_test
               union all
               select
                   '全国' as teacher_region
               from
                   test.dp_class_student_test
           ) as aaa
       where teacher_region in ('全国');
       ```
   **Expected behavior**
   take teacher_region as string to do filter in the table, run and return 
right result
   
   **Doris Be and Fe version
   - version 0.12.21
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to