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.27k stars 1.67k forks source link

Unkown error for query partition key <> value || != value #46351

Open huoarter opened 1 month ago

huoarter commented 1 month ago

表语句

CREATE TABLE `t1` (
  `k1` bigint(20) NOT NULL COMMENT "",
  `c1` bigint(20) NULL COMMENT ""
) ENGINE=OLAP 
DUPLICATE KEY(`k1`)
PARTITION BY (`k1`)
DISTRIBUTED BY HASH(`k1`) BUCKETS 32 
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"enable_persistent_index" = "false",
"replicated_storage" = "true",
"compression" = "LZ4"
);

插入数据 insert into t1 values(1, 1); 当查询分区键不等于存在的分区键值时报Unkown error

mysql> select * from t1 where k1 !=1; ERROR 1064 (HY000): Unknown error

mysql> select * from t1 where k1 <> 1; ERROR 1064 (HY000): Unknown error

下面是OK的语句: mysql> select * from t1 where k1 =1; +------+------+ | k1 | c1 | +------+------+ | 1 | 1 | | 1 | 1 | +------+------+ 2 rows in set (0.01 sec)

mysql> select * from t1 where k1 !=2; +------+------+ | k1 | c1 | +------+------+ | 1 | 1 | | 1 | 1 | +------+------+ 2 rows in set (0.01 sec)

cfytrok commented 3 weeks ago

Looks like it's related to partition. The bug is repeated on versions 3.2.6, 3.2.7. Not on 3.2.4. SQL Error [1064] [42000]: Unknown error Workarounds: disable PARTITION or select * from t1 where k1 not in (select(1))

huoarter commented 2 days ago

The main migration to Starrocks has a lot of such query syntax, and the migration process will be more complicated. There are of course many ways to workaround. I hope to upgrade to 3.2x or above as soon as possible.