Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The result of utf8mb4_general_ci collation with mpp is not correct #3391

Closed
lilinghai opened this issue Nov 5, 2021 · 0 comments · Fixed by #3392
Closed

The result of utf8mb4_general_ci collation with mpp is not correct #3391

lilinghai opened this issue Nov 5, 2021 · 0 comments · Fixed by #3392

Comments

@lilinghai
Copy link

1.txt

source 1.txt
select `col_char(20)_undef_signed`,count( distinct `col_double_key_signed` ) as x from table_1000_utf8mb4collate_utf8mb4_general_ci_undef as t1 group by t1. `col_char(20)_undef_signed` having not exists (select `col_int_undef_unsigned` from table_1_binary_undef as t2 where  case when x then t2. `col_int_key_signed` else 1 end) order by `col_char(20)_undef_signed`;
-- expect the result value of column `col_char(20)_undef_signed` is same for the collation utf8mb4_general_ci
/*
explain select `col_char(20)_undef_signed`,count( distinct `col_double_key_signed` ) as x from table_1000_utf8mb4collate_utf8mb4_general_ci_undef as t1 group by t1. `col_char(20)_undef_signed` having not exists (select `col_int_undef_unsigned` from table_1_binary_undef as t2 where  case when x then t2. `col_int_key_signed` else 1 end) order by `col_char(20)_undef_signed`;
+------------------------------------------+----------+-------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id                                       | estRows  | task              | access object | operator info                                                                                                                                                                                                                                                                                                                                                                            |
+------------------------------------------+----------+-------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Sort_11                                  | 6400.00  | root              |               | rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed                                                                                                                                                                                                                                                                                                          |
| └─TableReader_31                         | 6400.00  | root              |               | data:ExchangeSender_30                                                                                                                                                                                                                                                                                                                                                                   |
|   └─ExchangeSender_30                    | 6400.00  | batchCop[tiflash] |               | ExchangeType: PassThrough                                                                                                                                                                                                                                                                                                                                                                |
|     └─HashJoin_13                        | 6400.00  | batchCop[tiflash] |               | CARTESIAN anti semi join, other cond:case(Column#47, rs.table_1_binary_undef.col_int_key_signed, 1)                                                                                                                                                                                                                                                                                      |
|       ├─ExchangeReceiver_29(Build)       | 10000.00 | batchCop[tiflash] |               |                                                                                                                                                                                                                                                                                                                                                                                          |
|       │ └─ExchangeSender_28              | 10000.00 | batchCop[tiflash] |               | ExchangeType: Broadcast                                                                                                                                                                                                                                                                                                                                                                  |
|       │   └─TableFullScan_27             | 10000.00 | batchCop[tiflash] | table:t2      | keep order:false, stats:pseudo                                                                                                                                                                                                                                                                                                                                                           |
|       └─Projection_15(Probe)             | 8000.00  | batchCop[tiflash] |               | rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed, Column#47                                                                                                                                                                                                                                                                                               |
|         └─Projection_23                  | 8000.00  | batchCop[tiflash] |               | Column#47, rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed                                                                                                                                                                                                                                                                                               |
|           └─HashAgg_24                   | 8000.00  | batchCop[tiflash] |               | group by:rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed, funcs:count(distinct rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_double_key_signed)->Column#47, funcs:firstrow(rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed)->rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed |
|             └─ExchangeReceiver_26        | 8000.00  | batchCop[tiflash] |               |                                                                                                                                                                                                                                                                                                                                                                                          |
|               └─ExchangeSender_25        | 8000.00  | batchCop[tiflash] |               | ExchangeType: HashPartition, Hash Cols: [name: rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed, collate: utf8mb4_general_ci]                                                                                                                                                                                                                             |
|                 └─HashAgg_17             | 8000.00  | batchCop[tiflash] |               | group by:rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_char(20)_undef_signed, rs.table_1000_utf8mb4collate_utf8mb4_general_ci_undef.col_double_key_signed,                                                                                                                                                                                                                   |
|                   └─TableFullScan_22     | 10000.00 | batchCop[tiflash] | table:t1      | keep order:false, stats:pseudo                                                                                                                                                                                                                                                                                                                                                           |
+------------------------------------------+----------+-------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
14 rows in set (0.04 sec)
*/

The unexpected result is as follows
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants