Skip to content

First Major Release

Compare
Choose a tag to compare
@0aix 0aix released this 04 Jan 17:27
· 53 commits to master since this 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).

  1. 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
    
  2. 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()
    
  3. Added support for HAVING for all queries with GROUP BY. Previously, HAVING was only supported for the special form of TOP K queries.

  4. 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 and foo.0.a for a list of maps. Now, square brackets are used to index into lists. Accessing a list of maps would now look like foo[0].a. Simply accessing the list would be foo[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 format CAST(field AS type). Previously, it was CAST(field, type)

    4.6. ANY/ALL have been added for all comparison operators. For example, abc = ANY [1, 2, 3] is equivalent to abc = 1 OR abc = 2 OR abc = 3, and abc != ALL [1, 2, 3] is equivalent to abc != 1 AND abc != 2 AND abc != 3

    4.7. XOR has been added in addition to AND and OR

    4.8. Added new functions SIZEIS, FILTER, and IF

    • SIZEIS(a : string/list/map, b : integer) is true if the size of a equals b
    • FILTER(a : list, b : boolean list) returns a list consisting of the elements a[i] where b[i] is true.
    • IF(b : boolean, val1, val2) returns val1 if b is true and val2 otherwise.

    4.9. The following predicates have been removed or changed.

    • [NOT] BETWEEN _ AND _ removed.
    • LIKE changed to RLIKE and RLIKE ANY for regex matching. NOT is not supported before RLIKE
    • IS [NOT] DISTINCT FROM removed.
    • IS [NOT] EMPTY removed. Use SIZEIS instead.
    • CONTAINSKEY and CONTAINSVALUE are now functions rather than infix operators.