StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
9.17k stars 1.82k forks source link

range partition key name prefix with '#' issue in 3.3.0rc2 #46882

Open sanikoyes opened 5 months ago

sanikoyes commented 5 months ago

In current master(3.3.0rc2) version, when a field starting with the # character is used as the key of a range partition expression, and there is a field with the same name that does not start with # in the table, the system will recognize that the field that does not start with # is used as the partition field.

Steps to reproduce the behavior (Required)

  1. CREATE TABLE
    CREATE TABLE site_access1 (
    `#event_day` DATETIME NOT NULL,
    site_id INT DEFAULT '10',
    city_code VARCHAR(100),
    user_name VARCHAR(32) DEFAULT '',
    event_day DATETIME NOT NULL,
    pv BIGINT DEFAULT '0'
    )
    DUPLICATE KEY(`#event_day`, site_id, city_code, user_name)
    PARTITION BY date_trunc('day', `#event_day`)
    DISTRIBUTED BY HASH(`#event_day`, site_id);
  2. SHOW CREATE TABLE

Partition range key #event_day -> event_day

Expected behavior (Required)

PARTITION BY date_trunc('day', #event_day)

Real behavior (Required)

PARTITION BY date_trunc('day', event_day)

StarRocks version (Required)

xiangguangyxg commented 4 months ago

Fixed in 3.3.0