Skip to content

[Bug] Zorder排序表第一列作为过滤列,查询结果错误 #21051

@fengfuyuyang

Description

@fengfuyuyang

Search before asking

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

Version

doris-1.2.4.1

What's Wrong?

使用Zorder排序后,当第一列作为过滤列时,查询结果为全表查询,非过滤结果

-- Zorder排序表,建表sql
CREATE
    TABLE
        ZORDER_TEST(
            `S_ID` BIGINT,
            `S_SUPPKEY` BIGINT ,
            `S_NAME` CHAR(25) ,
            `S_ADDRESS` VARCHAR(40) ,
            `S_NATIONKEY` BIGINT ,
            `S_PHONE` CHAR(15) ,
            `S_ACCTBAL` DOUBLE ,
            `S_COMMENT` VARCHAR(117)
        ) ENGINE = OLAP
        DUPLICATE KEY(`S_ID`, `S_SUPPKEY`)
        COMMENT 'OLAP' DISTRIBUTED BY HASH(`S_ID`) BUCKETS 10
        PROPERTIES(
            "replication_allocation" = "tag.location.default: 1" ,
            "data_sort.sort_type" = "ZORDER" ,
            "data_sort.col_num" = "2" ,
            "in_memory" = "false" ,
            "storage_format" = "V2" ,
            "disable_auto_compaction" = "false"
        )
;

建表sql参考自 #7149

数据来源,通过脚本生成test_data.csv文件

#!/usr/bin/env python
# coding=utf-8
import random
import csv

with open('test_data.csv', 'w', newline='') as csvfile:
    fieldnames = ['S_ID', 'S_SUPPKEY', 'S_NAME', 'S_ADDRESS', 'S_NATIONKEY', 'S_PHONE', 'S_ACCTBAL', 'S_COMMENT']
    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
    for i in range(1000000):
        writer.writerow({
            'S_ID': i,
            'S_SUPPKEY': random.randint(1, 1000000),
            'S_NAME': f'Supplier_{i}',
            'S_ADDRESS': f'Address_{random.randint(1, 100)}',
            'S_NATIONKEY': i+10086,
            'S_PHONE': f'{random.randint(100, 999)}-{random.randint(100, 999)}-{random.randint(1000, 9999)}',
            'S_ACCTBAL': round(random.uniform(-10000, 10000), 2),
            'S_COMMENT': f'Comment_{i}'
        })

csv加载数据

curl  --location-trusted -u root: -T test_data.csv -H "column_separator:," http://127.0.0.1:8030/api/demo/ZORDER_TEST/_stream_load

过滤查询

select * from ZORDER_TEST where S_ID=181818

查询结果
image

What You Expected?

  1. Zorder排序表第一列可以作为过滤列正常查询,若不可以给出原因;
  2. Zorder排序表缺少详细介绍,应用场景,使用是否有什么限制等等,可否详细介绍下。

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions