forked from hyrise/hyrise
-
Notifications
You must be signed in to change notification settings - Fork 0
Generate Table Script
Alexander Riese edited this page Feb 4, 2019
·
1 revision
from random import randint
group_col_names = ["group1", "group2", "group3"]
def write_file(filename, agg_col, group_cols, group_type):
with open(filename, "w") as f:
f.write("agg" + "|" + "|".join(group_col_names[:len(group_cols)]))
f.write("\n")
f.write("int" + "|" + "|".join([group_type] * len(group_cols)) )
f.write("\n")
for line in zip(agg_col, *group_cols):
f.write("|".join(line))
f.write("\n")
table_size = 1000000
agg_col = [str(randint(0, 100)) for _ in range(table_size)]
group_col1 = [str(randint(0, 100)) for _ in range(table_size)]
group_col2 = [str(randint(0, 100)) for _ in range(table_size)]
group_col3 = [str(randint(0, 100)) for _ in range(table_size)]
write_file("int1.txt", agg_col, [group_col1], "int")
write_file("int2.txt", agg_col, [group_col1, group_col2], "int")
write_file("int3.txt", agg_col, [group_col1, group_col2, group_col3], "int")
write_file("string1.txt", agg_col, [group_col1], "string")
write_file("string2.txt", agg_col, [group_col1, group_col2], "string")
write_file("string3.txt", agg_col, [group_col1, group_col2, group_col3], "string")