MCPcopy Create free account
hub / github.com/apache/impala / get_columns

Function get_columns

testdata/common/widetable.py:35–52  ·  view source on GitHub ↗

Returns 'num_cols' column declarations, cycling through every column type, as a a list of strings.

(num_cols)

Source from the content-addressed store, hash-verified

33parser.add_option("--num_rows", dest="num_rows", default=10)
34
35def get_columns(num_cols):
36 """Returns 'num_cols' column declarations, cycling through every column type, as a
37 a list of strings."""
38 templates = [
39 'bool_col%i BOOLEAN',
40 'tinyint_col%i TINYINT',
41 'smallint_col%i SMALLINT',
42 'int_col%i INT',
43 'bigint_col%i BIGINT',
44 'float_col%i FLOAT',
45 'double_col%i DOUBLE',
46 'string_col%i STRING',
47 ]
48
49 iter = itertools.cycle(templates)
50 # Produces [bool_col1, tinyint_col1, ..., bool_col2, tinyint_col2, ...]
51 # The final list has 'num_cols' elements.
52 return [next(iter) % (i // len(templates) + 1) for i in range(num_cols)]
53
54# Data generators for different types. Each generator yields an infinite number of
55# value strings suitable for writing to a CSV file.

Callers 1

widetable.pyFile · 0.85

Calls 2

rangeFunction · 0.85
nextFunction · 0.50

Tested by

no test coverage detected