You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "fengfuyuyang (via GitHub)" <gi...@apache.org> on 2023/06/21 01:34:43 UTC

[GitHub] [doris] fengfuyuyang opened a new issue, #21051: [Bug] Zorder排序表第一列作为过滤列,查询结果错误

fengfuyuyang opened a new issue, #21051:
URL: https://github.com/apache/doris/issues/21051

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   doris-1.2.4.1
   
   ### What's Wrong?
   
   使用Zorder排序后,当第一列作为过滤列时,查询结果为全表查询,非过滤结果
   ``` sql
   -- 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参考自 https://github.com/apache/doris/pull/7149
   
   数据来源,通过脚本生成`test_data.csv`文件
   ``` py
   #!/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加载数据
   ``` bash
   curl  --location-trusted -u root: -T test_data.csv -H "column_separator:," http://127.0.0.1:8030/api/demo/ZORDER_TEST/_stream_load
   ```
   
   过滤查询
   ``` sql
   select * from ZORDER_TEST where S_ID=181818;
   ```
   查询结果
   ![image](https://github.com/apache/doris/assets/63083353/a13d168f-eda9-4804-b2c2-065b4bdc1092)
   
   
   
   ### 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
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org.apache.org

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