2021-09-12 12:35:27 +00:00
-- Tags: no-ordinary-database, no-fasttest
-- Tag no-ordinary-database: Sometimes cannot lock file most likely due to concurrent or adjacent tests, but we don't care how it works in Ordinary database
-- Tag no-fasttest: In fasttest, ENABLE_LIBRARIES=0, so rocksdb engine is not enabled by default
2021-06-02 15:55:20 +00:00
DROP TABLE IF EXISTS 01504 _test ;
2020-11-11 01:39:09 +00:00
2024-05-30 12:27:25 +00:00
CREATE TABLE 01504 _test ( key String , value UInt32 ) Engine = EmbeddedRocksDB ; -- { serverError BAD_ARGUMENTS }
CREATE TABLE 01504 _test ( key String , value UInt32 ) Engine = EmbeddedRocksDB PRIMARY KEY ( key2 ) ; -- { serverError UNKNOWN_IDENTIFIER }
CREATE TABLE 01504 _test ( key String , value UInt32 ) Engine = EmbeddedRocksDB PRIMARY KEY ( key , value ) ; -- { serverError BAD_ARGUMENTS }
2021-06-02 15:55:20 +00:00
CREATE TABLE 01504 _test ( key Tuple ( String , UInt32 ) , value UInt64 ) Engine = EmbeddedRocksDB PRIMARY KEY ( key ) ;
2020-11-11 01:39:09 +00:00
2021-06-02 15:55:20 +00:00
DROP TABLE IF EXISTS 01504 _test ;
CREATE TABLE 01504 _test ( key String , value UInt32 ) Engine = EmbeddedRocksDB PRIMARY KEY ( key ) ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
INSERT INTO 01504 _test SELECT ' 1_1 ' , number FROM numbers ( 10000 ) ;
SELECT COUNT ( 1 ) = = 1 FROM 01504 _test ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
INSERT INTO 01504 _test SELECT concat ( toString ( number ) , ' _1 ' ) , number FROM numbers ( 10000 ) ;
SELECT COUNT ( 1 ) = = 10000 FROM 01504 _test ;
SELECT uniqExact ( key ) = = 32 FROM ( SELECT * FROM 01504 _test LIMIT 32 SETTINGS max_block_size = 1 ) ;
SELECT SUM ( value ) = = 1 + 99 + 900 FROM 01504 _test WHERE key IN ( ' 1_1 ' , ' 99_1 ' , ' 900_1 ' ) ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
DROP TABLE IF EXISTS 01504 _test ;
DROP TABLE IF EXISTS 01504 _test_memory ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
CREATE TABLE 01504 _test ( k UInt32 , value UInt64 , dummy Tuple ( UInt32 , Float64 ) , bm AggregateFunction ( groupBitmap , UInt64 ) ) Engine = EmbeddedRocksDB PRIMARY KEY ( k ) ;
CREATE TABLE 01504 _test_memory AS 01504 _test Engine = Memory ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
INSERT INTO 01504 _test SELECT number % 77 AS k , SUM ( number ) AS value , ( 1 , 1 . 2 ) , bitmapBuild ( groupArray ( number ) ) FROM numbers ( 10000000 ) group by k ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
INSERT INTO 01504 _test_memory SELECT number % 77 AS k , SUM ( number ) AS value , ( 1 , 1 . 2 ) , bitmapBuild ( groupArray ( number ) ) FROM numbers ( 10000000 ) group by k ;
2020-10-01 10:45:53 +00:00
2021-06-02 15:55:20 +00:00
SELECT A . a = B . a , A . b = B . b , A . c = B . c , A . d = B . d , A . e = B . e FROM ( SELECT 0 AS a , groupBitmapMerge ( bm ) AS b , SUM ( k ) AS c , SUM ( value ) AS d , SUM ( dummy . 1 ) AS e FROM 01504 _test ) A ANY LEFT JOIN ( SELECT 0 AS a , groupBitmapMerge ( bm ) AS b , SUM ( k ) AS c , SUM ( value ) AS d , SUM ( dummy . 1 ) AS e FROM 01504 _test_memory ) B USING a ORDER BY a ;
2020-10-01 10:45:53 +00:00
2021-12-09 22:40:03 +00:00
CREATE TEMPORARY TABLE keys AS SELECT * FROM system . numbers LIMIT 1 OFFSET 4 ;
2020-10-01 10:45:53 +00:00
SET max_rows_to_read = 2 ;
2021-06-02 15:55:20 +00:00
SELECT dummy = = ( 1 , 1 . 2 ) FROM 01504 _test WHERE k IN ( 1 , 3 ) OR k IN ( 1 ) OR k IN ( 3 , 1 ) OR k IN [ 1 ] OR k IN [ 1 , 3 ] ;
SELECT k = = 4 FROM 01504 _test WHERE k = 4 OR k IN [ 4 ] OR k in ( 4 , 10000001 , 10000002 ) AND value > 0 ;
SELECT k = = 4 FROM 01504 _test WHERE k IN ( SELECT toUInt32 ( number ) FROM keys WHERE number = 4 ) ;
2024-05-30 12:27:25 +00:00
SELECT k , value FROM 01504 _test WHERE k = 0 OR value > 0 ; -- { serverError TOO_MANY_ROWS }
SELECT k , value FROM 01504 _test WHERE k = 0 AND k IN ( 1 , 3 ) OR k > 8 ; -- { serverError TOO_MANY_ROWS }
2020-10-01 10:45:53 +00:00
2021-06-02 15:55:20 +00:00
TRUNCATE TABLE 01504 _test ;
SELECT 0 = = COUNT ( 1 ) FROM 01504 _test ;
2020-09-02 09:13:59 +00:00
2021-06-02 15:55:20 +00:00
DROP TABLE IF EXISTS 01504 _test ;
DROP TABLE IF EXISTS 01504 _test_memory ;