Skip to content

[Bug] (nereids) Close PREAGGREGATION in simple aggregation #33351

@liutang123

Description

@liutang123

Search before asking

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

Version

2.1.1

What's Wrong?

  1. Create a olap table:
CREATE TABLE `llj_test` (
  `timeSec` BIGINT NULL COMMENT '',
  `ruleId` BIGINT NULL COMMENT '',
  `decisionId` BIGINT NULL COMMENT '',
  `isEffect` TINYINT NULL COMMENT '',
  `isMarked` TINYINT NULL COMMENT '',
  `userid` BIGINT NULL COMMENT '',
  `orderid` BIGINT NULL COMMENT '',
  `uuid` VARCHAR(128) NULL COMMENT '',
  `businessCode` INT NULL COMMENT '',
  `sceneId` BIGINT NULL COMMENT '',
  `action` INT NULL COMMENT '',
  `mobile` VARCHAR(32) NULL COMMENT '',
  `mobile_operatorname` VARCHAR(64) NULL COMMENT '',
  `dealid` BIGINT NULL COMMENT '',
  `requestId` VARCHAR(64) NULL COMMENT '',
  `timeMin` INT NULL COMMENT '',
  `hitRules` VARCHAR(2048) NULL COMMENT '',
  `dt` INT NULL COMMENT '',
  `requestNum` INT SUM NULL COMMENT '',
  `expandNum` DOUBLE SUM NULL COMMENT ''
) ENGINE=OLAP
AGGREGATE KEY(`timeSec`, `ruleId`, `decisionId`, `isEffect`, `isMarked`, `userid`, `orderid`, `uuid`, `businessCode`, `sceneId`, 
              `action`, `mobile`, `mobile_operatorname`, `dealid`, `requestId`, `timeMin`, `hitRules`, `dt`)
COMMENT '测试'
PARTITION BY RANGE(`dt`)
(PARTITION p20240304 VALUES [("19700101"), ("20240409")),
PARTITION p20240410 VALUES [("20240409"), ("20240410")))
DISTRIBUTED BY HASH(`timeSec`) BUCKETS 6
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"min_load_replica_num" = "-1",
"bloom_filter_columns" = "orderid, sceneId",
"is_being_synced" = "false",
"storage_medium" = "hdd",
"storage_format" = "V2",
"inverted_index_storage_format" = "V1",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728"
);
  1. Insert som data.
insert  into llj_test values(123,444,555,1,1,6666,7777,'uuid', 1,8,9,'mobile', 'mobile_operatorname',10,'requestId',1234,'111',20240409,-1,-2)
  1. explain a simple aggregation sql:
set global experimental_enable_nereids_planner = true;

select requestid,
               sceneid,
    max(timeSec) maxTime
          from llj_test
         where dt between 20240403 AND 20240410
           AND ruleId = 2279
           and timeSec between UNIX_TIMESTAMP('2024-04-03 00:03:46') AND UNIX_TIMESTAMP('2024-04-10 23:59:49')
         group by requestId,
                  sceneid
order by maxTime desc
limit 100;
The OlapScanNode's PREAGGREGATION is OFF and reaseon is No aggregate on scan. 

What You Expected?

The PREAGGREGATION should be ON

How to Reproduce?

See bug description.

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