teragrep / pth_03

Data Processing Language (DPL) parser
GNU Affero General Public License v3.0
0 stars 5 forks source link

Stats command doesn't work with aggregates with no field argument #25

Open 51-code opened 7 months ago

51-code commented 7 months ago

Describe the bug

index=abc earliest=-4y | stats avg by host Results in an exception: java.lang.IllegalStateException: failed to parse at line 2:35 due to mismatched input 'avg' expecting {'avg(', 'mean(', 'c(', 'count(', METHOD_AGGREGATE_COUNT, METHOD_AGGREGATE_COUNT_C, 'dc(', 'distinct_count(', 'earliest(', 'earliest_time(', 'estdc(', 'estdc_error(', 'first(', 'last(', 'latest(', 'latest_time(', 'list(', 'max(', 'median(', 'min(', 'mode(', 'p(', 'perc(', 'exactperc(', 'upperperc(', METHOD_AGGREGATE_P_VARIABLE, METHOD_AGGREGATE_PERC_VARIABLE, METHOD_AGGREGATE_EXACTPERC_VARIABLE, METHOD_AGGREGATE_UPPERPERC_VARIABLE, 'percint(', 'range(', 'rate(', 'stdev(', 'stdevp(', 'sum(', 'sumsq(', 'values(', 'var(', 'varp(', 'per_second(', 'per_hour(', 'per_day(', 'per_minute(', 'partitions=', COMMAND_STATS_MODE_ALLNUM, COMMAND_STATS_MODE_DELIM}

Expected behavior

The query should parse. Correct implementation in PTH-10 would result in a table with numerous columns of data for different averages. This should work for any aggregate command (not just avg).

How to reproduce

Run the query.

Screenshots

Software version

5.4.0

Desktop (please complete the following information if relevant):

Additional context