• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

parser/H03-May-2022-1,4821,205

README.mdH A D10-Dec-20213.2 KiB5343

flb_sp.cH A D10-Dec-202167.6 KiB2,2501,755

flb_sp_aggregate_func.cH A D10-Dec-202112.4 KiB365312

flb_sp_func_record.cH A D10-Dec-20212.4 KiB7946

flb_sp_func_time.cH A D10-Dec-20212.7 KiB9757

flb_sp_groupby.cH A D10-Dec-20212.7 KiB8454

flb_sp_key.cH A D10-Dec-20216.3 KiB233170

flb_sp_snapshot.cH A D10-Dec-20218.1 KiB279202

flb_sp_stream.cH A D10-Dec-20215.3 KiB170102

flb_sp_window.cH A D10-Dec-20214.6 KiB12491

README.md

1## SQL Statement Syntax
2
3The following is the SQL statement syntax supported by Fluent Bit stream processor in EBNF form. For readability, we assume the conventional definition for integer, float and string values. A single quote in a constant string literal has to be escaped with an extra one. For instance, the string representation of `O'Keefe` in the query will be `'O''Keefe'`.
4
5```xml
6<sql_stmt>    := <create> | <select>
7<create>      := CREATE STREAM <id> AS <select> | CREATE STREAM <id> WITH (<properties>) AS <select>
8<properties>  := <property> | <property>, <properties>
9<property>    := <id> = '<id>'
10<select>      := SELECT <keys> FROM <source> [WHERE <condition>]
11               [WINDOW TUMBLING (<integer> SECOND) | WINDOW HOPPING (<integer> SECOND, ADVANCE BY <integer> SECOND)]
12               [GROUP BY <record_keys>]
13<keys>        := '*' | <record_keys>
14<record_keys> := <record_key> | <record_key>, <record_keys>
15<record_key>  := <exp> | <exp> AS <id>
16<exp>         := <key> | <fun>
17<fun>         := AVG(<key>) | SUM(<key>) | COUNT(<key>) | COUNT(*) | MIN(<key>) | MAX(<key>) | <timeseries>
18<timeseries>  := FORECAST(<key>, <key>, <value>) | FORECAST_R(<key>, <key>, <value>, <value>)
19<source>      := STREAM:<id> | TAG:<id>
20<condition>   := <key> | <value> | <key> <relation> <value> | (<condition>)
21               | NOT <condition> | <condition> AND <condition> | <condition> OR <condition>
22               | @record.contains(<key>) | <id> IS NULL | <id> IS NOT NULL
23<key>         := <id> | <id><subkey-idx>
24<subkey-idx>  := [<id>] | <subkey-idx>[<id>]
25<relation>    := = | != | <> | < | <= | > | >=
26<id>          := <letter> <characters>
27<characters>  := <letter> | <digit> | _ | <characters> <characters>
28<value>       := true | false | <integer> | <float> | '<string>'
29```
30
31In addition to the aggregation functions, Stream Processor provides the following timeseries functions. `FORECAST` and `FORECAST_R` functions use simple linear regression algorithm as the forecasting method.
32
33### Timeseries Functions
34
35| name                     | description                                                                         |
36| ------------------------ | ----------------------------------------------------------------------------------- |
37| FORECAST(x, y, n)        | forecasts the value of y at x + n (use RECORD_TAG() for x for time-based forecast). |
38| FORECAST_R(x, y, n, cap) | forecasts the value of x (max = cap) in which y will become n.                      |
39
40### Time Functions
41
42| name             | description                                       | example             |
43| ---------------- | ------------------------------------------------- | ------------------- |
44| NOW()            | adds system time using format: %Y-%m-%d %H:%M:%S. | 2019-03-09 21:36:05 |
45| UNIX_TIMESTAMP() | add current Unix timestamp                        | 1552196165          |
46
47### Record Functions
48
49| name          | description                                                  | example           |
50| ------------- | ------------------------------------------------------------ | ----------------- |
51| RECORD_TAG()  | append Tag string associated to the record                   | samples           |
52| RECORD_TIME() | append record Timestamp in _double_ format: seconds.nanoseconds | 1552196165.705683 |
53