Skip to content

Commit 1a329e9

Browse files
authored
test create column table with various column types (#13054)
1 parent d90bd31 commit 1a329e9

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

ydb/tests/workloads/olap_workload/__main__.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,39 @@ def join(self):
103103
t.join()
104104

105105

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+
106139
class WorkloadTablesCreateDrop(WorkloadBase):
107140
def __init__(self, client, prefix, stop):
108141
super().__init__(client, prefix, "create_drop", stop)
@@ -130,13 +163,17 @@ def _get_existing_table_n(self):
130163

131164
def create_table(self, table):
132165
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+
133171
stmt = f"""
134172
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)])})
138175
)
139-
PARTITION BY HASH(id)
176+
PARTITION BY HASH({", ".join(["c" + str(i) for i in range(partition_key_column_n)])})
140177
WITH (
141178
STORE = COLUMN
142179
)

0 commit comments

Comments
 (0)