- All queries are linearized to check only one fields condition
- The results of the queries are combined in a stack to create more complex queries
- The expressions use a stack with Reversed Polish Notation
query = (selectstatement | importstatement | wherestatement | groupstatement | orderstatement | limitstatement | UNION | exceptstatement | joinstatement | CROSS | COPY | POP | SWAP | projectstatement | ROTATE | renamestatement | formatstatement | numberformatstatement | calcstatement | templatestatement | outputstatement | stylestatement | FIELDS | SHOWKEY | VERBOSE)+
selectstatement = SELECT fieldlist (FROM (VIRTUAL)? name)? (wherestatement)?
fieldlist = field (, field)*
name = string
wherestatement = WHERE field (operator string | dollaroperator expression)
operator = ($)? (!)? (numericoperator | stringoperator | relaxedstringoperator | otheroperator)
numericoperator = (= | <> | < | > | <= | >=)
stringoperator = (== | =* | *= | *=* | << | >> | >=)
relaxedstringoperator = { ~~ | !~ | ~* | *~ | *~* )
otheroperator = (* | 0 | r=)
dollaroperator = $operator
expression = (field | number | quotedstring | + | - | * | / | . | :: | ABS | SIGN | COPY | POP | SWAP | SUBSTR | REPLACE | TRIM )*
quotedstring = "(.)+(""(.)*)*"
importstatement = IMPORT (TAB|FIELDS) name
groupstatement = GROUP (fieldaggregation) (, fieldaggregation)* BY fieldlist
fieldaggregation = field (COUNT | SUM | MIN | MAX | AVG | NULL)?
orderstatement = ORDER fieldorder (, fieldorder)*
fieldorder = field (NUMERIC)? (DESC)?
limistatement = LIMIT number number
orstatement = UNION
exceptstatement = EXCEPT (field)?
joinstatement = (JOIN | LEFTJOIN | OUTERJOIN) field
projectstatement = PROJECT fieldlist
renamestatement = RENAME (field | * | # ) string (, field string)*
keystatement = KEY expression
formatstatement = FORMAT field string
numberformatstatement = NUMERFORMAT field (number)? (, field (number)? )*
calcstatement = CALC field expression
templatestatement = TEMPLATE field templatename
outputstatement = OUTPUT (HTML | FIXED (fieldlist)* | FIELDS | TAB | TABHEADER | TEXT | TEXTSPACE | ROWTEMPLATE string)
stylestatement = STYLE string