@@ -103,6 +103,39 @@ def join(self):
103
103
t .join ()
104
104
105
105
106
+ supported_pk_types = [
107
+ # Bool https://github.com/ydb-platform/ydb/issues/13037
108
+ "Int8" ,
109
+ "Int16" ,
110
+ "Int32" ,
111
+ "Int64" ,
112
+ "Uint8" ,
113
+ "Uint16" ,
114
+ "Uint32" ,
115
+ "Uint64" ,
116
+ "Decimal(22,9)" ,
117
+ # "DyNumber", https://github.com/ydb-platform/ydb/issues/13048
118
+
119
+ "String" ,
120
+ "Utf8" ,
121
+ # Uuid", https://github.com/ydb-platform/ydb/issues/13047
122
+
123
+ "Date" ,
124
+ "Datetime" ,
125
+ "Datetime64" ,
126
+ "Timestamp" ,
127
+ # "Interval", https://github.com/ydb-platform/ydb/issues/13050
128
+ ]
129
+
130
+ supported_types = supported_pk_types + [
131
+ "Float" ,
132
+ "Double" ,
133
+ "Json" ,
134
+ "JsonDocument" ,
135
+ "Yson"
136
+ ]
137
+
138
+
106
139
class WorkloadTablesCreateDrop (WorkloadBase ):
107
140
def __init__ (self , client , prefix , stop ):
108
141
super ().__init__ (client , prefix , "create_drop" , stop )
@@ -130,13 +163,17 @@ def _get_existing_table_n(self):
130
163
131
164
def create_table (self , table ):
132
165
path = self .get_table_path (table )
166
+ column_n = random .randint (1 , 10000 )
167
+ primary_key_column_n = random .randint (1 , column_n )
168
+ partition_key_column_n = random .randint (1 , primary_key_column_n )
169
+ columns = [random .choice (supported_pk_types ) for _ in range (primary_key_column_n )] + [random .choice (supported_types ) for _ in range (column_n - primary_key_column_n )]
170
+
133
171
stmt = f"""
134
172
CREATE TABLE `{ path } ` (
135
- id Int64 NOT NULL,
136
- i64Val Int64,
137
- PRIMARY KEY(id)
173
+ { ", " .join (["c" + str (i ) + " " + columns [i ] + " NOT NULL" for i in range (column_n )])} ,
174
+ PRIMARY KEY({ ", " .join (["c" + str (i ) for i in range (primary_key_column_n )])} )
138
175
)
139
- PARTITION BY HASH(id )
176
+ PARTITION BY HASH({ ", " . join ([ "c" + str ( i ) for i in range ( partition_key_column_n )]) } )
140
177
WITH (
141
178
STORE = COLUMN
142
179
)
0 commit comments