Skip to content

Commit

Permalink
test create column table with various column types (#13054)
Browse files Browse the repository at this point in the history
  • Loading branch information
zverevgeny authored Dec 26, 2024
1 parent d90bd31 commit 1a329e9
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions ydb/tests/workloads/olap_workload/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,39 @@ def join(self):
t.join()


supported_pk_types = [
# Bool https://github.com/ydb-platform/ydb/issues/13037
"Int8",
"Int16",
"Int32",
"Int64",
"Uint8",
"Uint16",
"Uint32",
"Uint64",
"Decimal(22,9)",
# "DyNumber", https://github.com/ydb-platform/ydb/issues/13048

"String",
"Utf8",
# Uuid", https://github.com/ydb-platform/ydb/issues/13047

"Date",
"Datetime",
"Datetime64",
"Timestamp",
# "Interval", https://github.com/ydb-platform/ydb/issues/13050
]

supported_types = supported_pk_types + [
"Float",
"Double",
"Json",
"JsonDocument",
"Yson"
]


class WorkloadTablesCreateDrop(WorkloadBase):
def __init__(self, client, prefix, stop):
super().__init__(client, prefix, "create_drop", stop)
Expand Down Expand Up @@ -130,13 +163,17 @@ def _get_existing_table_n(self):

def create_table(self, table):
path = self.get_table_path(table)
column_n = random.randint(1, 10000)
primary_key_column_n = random.randint(1, column_n)
partition_key_column_n = random.randint(1, primary_key_column_n)
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)]

stmt = f"""
CREATE TABLE `{path}` (
id Int64 NOT NULL,
i64Val Int64,
PRIMARY KEY(id)
{", ".join(["c" + str(i) + " " + columns[i] + " NOT NULL" for i in range(column_n)])},
PRIMARY KEY({", ".join(["c" + str(i) for i in range(primary_key_column_n)])})
)
PARTITION BY HASH(id)
PARTITION BY HASH({", ".join(["c" + str(i) for i in range(partition_key_column_n)])})
WITH (
STORE = COLUMN
)
Expand Down

0 comments on commit 1a329e9

Please sign in to comment.