First Major Release
This release updates to Bullet Core 1.0.0 and with it comes full support for the Expressions rewrite. It also marks the removal of JSON and the transition to BQL as the main way of writing Bullet queries (barring the UI query builder).
-
Added support for Expressions in virtually all parts of the BQL query. Previously, arithmetic operations were limited to the SELECT clause, and logical and filter operations were limited to the WHERE clause. With the expressions rewrite, queries can be much more expressive. For example, the following query is valid:
SELECT AVG(abc + 5), SIZEOF(def) > 0 FROM STREAM() WHERE abc > 10 AND def IS NOT NULL GROUP BY SIZEOF(def) ORDER BY AVG(abc + 5) * -1 ASC
-
Added Expressions type-checking in query validation. Type errors such as adding a string will now be caught early and returned to the user. In addition, the user can provide a Schema (from Bullet Record 1.0.0), so that fields are type-checked as well.
For example, the following query would have an error if a schema were provided and the type of
abc
was not a number.SELECT abc + 5 FROM STREAM()
-
Added support for HAVING for all queries with GROUP BY. Previously, HAVING was only supported for the special form of TOP K queries.
-
Changes to BQL grammar
4.1. Extended field access now differentiates between lists and maps. Originally, the '.' notation was used to access maps and lists in the same way, e.g.
foo.bar.a
for accessing a map of maps andfoo.0.a
for a list of maps. Now, square brackets are used to index into lists. Accessing a list of maps would now look likefoo[0].a
. Simply accessing the list would befoo[0]
4.2. Lists can now be specified with square brackets
[]
, e.g.[1, 2, 3, 4, 5]
is an integer list. Note, lists cannot be nested and mixing types within the list is undefined behavior.4.3. Fields can be denoted with double quotes, i.e.
abc
and"abc"
are equivalent. This is useful for fields and aliases with whitespace or special characters, e.g."my field" AS "my alias"
. Note, strings are denoted with single quotes, i.e.'abc'
4.4. Windows are now specified with a WINDOWING clause and either the function EVERY() or TUMBLING(). Previously, it would be specified with WINDOWING(), e.g.
WINDOWING(TUMBLING, 5000, TIME)
SELECT * FROM STREAM() WINDOWING TUMBLING(5000, TIME)
4.5.
CAST
now uses the formatCAST(field AS type)
. Previously, it wasCAST(field, type)
4.6.
ANY/ALL
have been added for all comparison operators. For example,abc = ANY [1, 2, 3]
is equivalent toabc = 1 OR abc = 2 OR abc = 3
, andabc != ALL [1, 2, 3]
is equivalent toabc != 1 AND abc != 2 AND abc != 3
4.7.
XOR
has been added in addition toAND
andOR
4.8. Added new functions
SIZEIS
,FILTER
, andIF
SIZEIS(a : string/list/map, b : integer)
is true if the size ofa
equalsb
FILTER(a : list, b : boolean list)
returns a list consisting of the elementsa[i]
whereb[i]
is true.IF(b : boolean, val1, val2)
returnsval1
ifb
is true andval2
otherwise.
4.9. The following predicates have been removed or changed.
[NOT] BETWEEN _ AND _
removed.LIKE
changed toRLIKE
andRLIKE ANY
for regex matching.NOT
is not supported beforeRLIKE
IS [NOT] DISTINCT FROM
removed.IS [NOT] EMPTY
removed. UseSIZEIS
instead.CONTAINSKEY
andCONTAINSVALUE
are now functions rather than infix operators.