Skip to content

Parse float arguments to arithmetic functions

Heinz N. Gies requested to merge gh-c9098925/28/dalmatinerdb/arith-floats into master

Created by: davecromberge

For a given floating point input e.g 100.0, the lexer would output the following token: {float,1,100.0}.

The parser would not parse such a token correctly, and the parse tree would result in function_clause errors because the aforementioned tuple was retained.

For an example query

"SELECT mul('e4e93cf0-0353-47ae-9cf3-93f676b010e3'.'base'.'network'.*.'bytes_sent' BUCKET 'e4', 100.0) AS abc BEFORE \"2016-03-08 12:33:17\" FOR 600s".

The parse tree looked as follows:

[#{args => [[<<"abc">>],
    #{args => #{inputs => [#{args => [<<"e4">>,
            [<<"e4e93cf0-0353-47ae-9cf3-93f676b010e3">>,<<"base">>,
             <<"network">>,'*',<<"bytes_sent">>]],
           op => sget,
           return => metric,
           signature => [integer,integer,integer,glob,bucket]},
         {float,1,100.0}],
        name => <<"mul">>},
      op => fcall}],
   op => named,
   return => undefined}]

Merge request reports

Loading