Expressions

Boolean expressions

  • string_value IS [NOT] NULL
  • value [NOT] BETWEEN value AND value
  • value [NOT] IN ( value [, ...] )
  • string_value [NOT] CONTAINS string_value
  • string_value [NOT] LIKE string_value

    The CONTAINS AND LIKE statements are implemented with java.util.regex.Pattern.
    So the the pattern string should use Java regex syntax, which is not the same as traditional SQL regex syntax.
    For example, HBql uses 'foo.*bar' instead of 'foo*bar'.

Value expressions

  • IF bool_expr THEN value ELSE value END
  • CASE ( WHEN bool_expr THEN value [, ...] ) ELSE value END
  • A built-in function

Types

Strings

  • Strings are quoted with matching ' or " chars, e.g., 'val' and "val".
  • Embedded ' and " chars are embedded with a \ prefix.
  • Unicode and octal chars are encoded with \u and \ prefixes respectively.

Numbers

  • Numeric types are short, integer, long, float, and double.
  • Longs, floats, and doubles support L, F, and D suffixes, e.g., 3L, 3.0F, and 3.0D.

Column references

  • Column values can be referenced by family:column or alias name.

Parameters

  • Parameters are specified by :name notation.
  • Parameter types are not determined until a value is bound with a setParameter() call.
    Thus parameter types can change if bound with a different type in a subsequent setParameter() call.
  • Where appropriate, parameter values can be bound to a Collection value.

Operators

Operator ordering (decreasing precedence)

Operator Precedence Description Supported types
- right unary minus numeric
* / left multiplication, division numeric
+ - left addition, subtraction numeric (+ applies to string)
CONTAINS substring containment string
LIKE string pattern matching string
IS test for NULL string
BETWEEN containment numeric, string, date
IN set membership numeric, string, date, boolean
< = > = boolean inequality numeric, string, date
= != equality numeric, string, date
NOT right negation boolean
AND left logical intersection boolean
OR left logical union boolean