MCPcopy Create free account
hub / github.com/apache/arrow / generate_dict_strings

Function generate_dict_strings

python/benchmarks/parquet.py:60–66  ·  view source on GitHub ↗
(string_size, nunique, length, random_order=True)

Source from the content-addressed store, hash-verified

58
59
60def generate_dict_strings(string_size, nunique, length, random_order=True):
61 uniques = np.array([rands(string_size) for i in range(nunique)], dtype='O')
62 if random_order:
63 indices = np.random.randint(0, nunique, size=length).astype('i4')
64 else:
65 indices = np.arange(nunique).astype('i4').repeat(length // nunique)
66 return pa.DictionaryArray.from_arrays(indices, uniques)
67
68
69def generate_dict_table(num_cols, string_size, nunique, length,

Callers 1

generate_dict_tableFunction · 0.85

Calls 2

randsFunction · 0.90
arrayMethod · 0.45

Tested by

no test coverage detected