You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/03/03 07:48:58 UTC

[GitHub] [incubator-doris] francisoliverlee opened a new issue #5447: [union all same field with different types make EXCEPTION] Unexpected exception: Failed analysis after expr substitution.

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:
users@infra.apache.org



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


[GitHub] [incubator-doris] HappenLee edited a comment on issue #5447: [Bug][union all same field with different types make EXCEPTION] Unexpected exception: Failed analysis after expr substitution.

Posted by GitBox <gi...@apache.org>.
HappenLee edited a comment on issue #5447:
URL: https://github.com/apache/incubator-doris/issues/5447#issuecomment-794960744


   Hi, @francisoliverlee It's look like the problem of type cast. Before we fix the problem, you can use the sql like
   ```
   select
       distinct teacher_region
   from
       (
           select
               cast (teacher_region as varcher) as 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', '全国')
   ```
   to avoid the problem appear.


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [incubator-doris] francisoliverlee commented on issue #5447: [Bug][union all same field with different types make EXCEPTION] Unexpected exception: Failed analysis after expr substitution.

Posted by GitBox <gi...@apache.org>.
francisoliverlee commented on issue #5447:
URL: https://github.com/apache/incubator-doris/issues/5447#issuecomment-795183350


   1. tks


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [incubator-doris] HappenLee commented on issue #5447: [Bug][union all same field with different types make EXCEPTION] Unexpected exception: Failed analysis after expr substitution.

Posted by GitBox <gi...@apache.org>.
HappenLee commented on issue #5447:
URL: https://github.com/apache/incubator-doris/issues/5447#issuecomment-794960744


   It's look like the problem of type cast. 


----------------------------------------------------------------
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:
users@infra.apache.org



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