Skip to content

[Bug] where条件模糊查询like过滤数据出现问题 #29449

@guanghuan96

Description

@guanghuan96

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.0.3

What's Wrong?

加上like后把全部数据都过滤掉了
完整sql:
select
shop_no,
full_name
from tidb_prod_tikv.ehr_sync.organization
where shop_no in ('XDGY01','XDAHDY','XDZZZB','NKBO25','ADJN52','ADJN15')
and full_name not like '%虚店%'
and full_name not like '%直播%'

-- 查询样例数据
select
shop_no,
full_name
from tidb_prod_tikv.ehr_sync.organization -- 这是一张外链表
where shop_no in ('XDGY01','XDAHDY','XDZZZB','NKBO25','ADJN52','ADJN15')

数据如下:
shop_no full_name
NKBO25 济南历下泉城路恒隆KL
ADJN52 济南历下泉城路恒隆AD二店
ADJN15 济南市中经四路振华AD
XDGY01 云贵贵阳总部小程序虚店
XDAHDY 安徽抖音虚店
XDZZZB 河南地区直播库存店

-- 执行计划
explain
select
shop_no,
full_name
from tidb_prod_tikv.ehr_sync.organization
where shop_no in ('XDGY01','XDAHDY','XDZZZB','NKBO25','ADJN52','ADJN15')
and full_name not like '%虚店%'
and full_name not like '%直播%'

PLAN FRAGMENT 0
OUTPUT EXPRS:
shop_no[#52]
full_name[#8]
PARTITION: UNPARTITIONED

HAS_COLO_PLAN_NODE: false

VRESULT SINK

343:VEXCHANGE
offset: 0

PLAN FRAGMENT 1

PARTITION: RANDOM

HAS_COLO_PLAN_NODE: false

STREAM DATA SINK
EXCHANGE ID: 343
UNPARTITIONED

332:VJdbcScanNode
TABLE: ehr_sync.organization
QUERY: SELECT shop_no, full_name FROM ehr_sync.organization WHERE (full_name like '%虚店%') AND (shop_no IN ('XDGY01', 'XDAHDY', 'XDZZZB', 'NKBO25', 'ADJN52', 'ADJN15')) AND (full_name like '%直播%')
PREDICATES: NOT full_name[#8] like '%虚店%' AND shop_no[#52] IN ('XDGY01', 'XDAHDY', 'XDZZZB', 'NKBO25', 'ADJN52', 'ADJN15') AND NOT full_name[#8] like '%直播%'

What You Expected?

期望得到如下数据:
shop_no full_name
NKBO25 济南历下泉城路恒隆KL
ADJN52 济南历下泉城路恒隆AD二店
ADJN15 济南市中经四路振华AD

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions