MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / parseParam

Method parseParam

src/query/expression/Expressions.java:142–163  ·  view source on GitHub ↗

Helper that parses out the parameter from the expression @param param The parameter to parse @param metric_queries A list to store the parsed metrics in @param root The root tree @param data_query The time series query @param index Index of the parameter

(final String param, 
                                 final List<String> metric_queries,
                                 final ExpressionTree root, 
                                 final TSQuery data_query, 
                                 final int index)

Source from the content-addressed store, hash-verified

140 * @param index Index of the parameter
141 */
142 private static void parseParam(final String param,
143 final List<String> metric_queries,
144 final ExpressionTree root,
145 final TSQuery data_query,
146 final int index) {
147 if (param == null || param.length() == 0) {
148 throw new IllegalArgumentException("Parameter cannot be null or empty");
149 }
150
151 if (param.indexOf('(') > 0 && param.indexOf(')') > 0) {
152 // sub expression
153 final ExpressionTree sub_tree = parse(param, metric_queries, data_query);
154 root.addSubExpression(sub_tree, index);
155 } else if (param.indexOf(':') >= 0) {
156 // metric query
157 metric_queries.add(param);
158 root.addSubMetricQuery(param, metric_queries.size() - 1, index);
159 } else {
160 // expression parameter
161 root.addFunctionParameter(param);
162 }
163 }
164
165}
166

Callers 1

parseMethod · 0.95

Calls 6

parseMethod · 0.95
sizeMethod · 0.65
addSubExpressionMethod · 0.45
addMethod · 0.45
addSubMetricQueryMethod · 0.45
addFunctionParameterMethod · 0.45

Tested by

no test coverage detected