Skip to content

SQL parsing exception on worker node if the outer query is against distributed table and the scalar subquery contains bitmap function #6575

@yuzhichang

Description

@yuzhichang

(you don't have to strictly follow this form)

Describe the bug
I have a Clickhouse cluster, with distributed table dist_cdp_orders_partition_by_day, and local table cdp_cust_tag_yzc, cdp_orders_partition_by_day. I open clickhouse-client, connect to 10.126.144.141, issue following SQL:

-- ok!
SELECT toDate(order_complete_time) AS day, sum(order_total_sales) AS amount FROM cdp_orders_partition_by_day WHERE bitmapContains((SELECT groupBitmapState(mid_seq) FROM dist_cdp_cust_tag_yzc WHERE gender='男'), mid_seq) GROUP BY day ORDER BY day;

-- error! 
SELECT toDate(order_complete_time) AS day, sum(order_total_sales) AS amount FROM dist_cdp_orders_partition_by_day WHERE bitmapContains((SELECT groupBitmapState(mid_seq) FROM cdp_cust_tag_yzc WHERE gender='男'), mid_seq) GROUP BY day ORDER BY day;
↘ Progress: 279.46 million rows, 1.12 GB (408.36 million rows/s., 1.63 GB/s.)  96%Received exception from server (version 19.11.3):
Code: 62. DB::Exception: Received from localhost:9000. DB::Exception: Received from 10.126.144.147:9000. DB::Exception: Syntax error: failed at position 186: '\\\0\0up\00|\0Yz\0B~\0&�\0��\t\0��\n\0[n\0n\0�\0�\0cr\0�\0<\0�5\0h=\0����ېN��u�z!�7��J�pL�TV�?��G��0����Ժ����. Expected one of: NOT, BETWEEN, AND, alias, AS, OR, NOT LIKE, LIKE, GLOBAL IN, IN, GLOBAL NOT IN, NOT IN, Comma, QuestionMark, IS, token. 

The attached 9000.pcap is the capture on host 10.126.144.147 tcp port 9000. The TCP stream indicates that 10.126.144.147 failed to parse the SQL which 10.126.144.141 sent. It was clear that the the bitmap binary in the SQL caused the parsing exception.

  • Which ClickHouse server version to use
    ClickHouse server version 19.11.3.11, on CentOS 7
  • Which interface to use, if matters
    clickhouse CLI, version 19.11.3.11

Error message and/or stacktrace
If applicable, add screenshots to help explain your problem.
Screenshot_2019-08-20_23-52-53

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions