StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.65k stars 1.75k forks source link

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

Open sanikoyes opened 3 months ago

sanikoyes commented 3 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 1 month ago

Fixed in 3.3.0