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

Class DefaultProfile

tests/comparison/query_profile.py:73–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73class DefaultProfile(object):
74
75 def __init__(self):
76 # Bounds are (min, max) values, the actual value used will be selected from the
77 # bounds and each value within the range has an equal probability of being selected.
78 self._bounds = {
79 'MAX_NESTED_QUERY_COUNT': (0, 2),
80 'MAX_NESTED_EXPR_COUNT': (0, 2),
81 'SELECT_ITEM_COUNT': (1, 5),
82 'WITH_TABLE_COUNT': (1, 3),
83 'TABLE_COUNT': (1, 2),
84 'ANALYTIC_LEAD_LAG_OFFSET': (1, 100),
85 'ANALYTIC_WINDOW_OFFSET': (1, 100),
86 'INSERT_VALUES_ROWS': (1, 10)}
87
88 # Below are interdependent weights used to determine probabilities. The probability
89 # of any item being selected should be (item weight) / sum(weights). A weight of
90 # zero means the item will never be selected.
91 self._weights = {
92 'SELECT_ITEM_CATEGORY': {
93 'AGG': 3,
94 'ANALYTIC': 1,
95 'BASIC': 10},
96 'TYPES': {
97 Boolean: 1,
98 Char: 1,
99 Decimal: 1,
100 Float: 1,
101 Int: 10,
102 Timestamp: 1},
103 'RELATIONAL_FUNCS': {
104 # The weights below are "best effort" suggestions. Because QueryGenerator
105 # prefers to set column types first, and some functions are "supported" only
106 # by some types, it means functions can be pruned off from this dictionary,
107 # and that will shift the probabilities. A quick example if that if a Char
108 # column is chosen: LessThan may not have a pre-defined signature for Char
109 # comparison, so LessThan shouldn't be chosen with Char columns. The
110 # tendency to prune will shift as the "funcs" module is adjusted to
111 # add/remove signatures.
112 And: 2,
113 Coalesce: 2,
114 Equals: 40,
115 GreaterThan: 2,
116 GreaterThanOrEquals: 2,
117 In: 2,
118 If: 2,
119 IsDistinctFrom: 2,
120 IsNotDistinctFrom: 1,
121 IsNotDistinctFromOp: 1,
122 LessThan: 2,
123 LessThanOrEquals: 2,
124 NotEquals: 2,
125 NotIn: 2,
126 Or: 2},
127 'CONJUNCT_DISJUNCTS': {
128 # And and Or appear both under RELATIONAL_FUNCS and CONJUNCT_DISJUNCTS for the
129 # following reasons:
130 # 1. And and Or are considered "relational" by virtue of taking two arguments

Callers 6

__init__Method · 0.90
start_runFunction · 0.90
generate_random_queriesFunction · 0.90

Calls

no outgoing calls

Tested by 1