titlesidebar_labeldescription
Text functions
Text
Text function reference documentation.

This page describes the available functions to assist with performing text manipulation such as concatenation, case conversion, string length calculation, and pattern matching via regular expressions.

concat

concat(str, ...) - concatenates a string from one or more input values.

  1. SELECT firstName, lastName, concat(firstName, ' ', lastName) FROM names;
firstNamelastNameconcat
TimThompsonTim Thompson
AnnaThompsonAnna Thompson
AnnaMasonAnna Mason
TomJohnsonTom Johnson
TimSmithTim Smith

:::tip

concat() can be used to generate line protocol. See example below.

:::

  1. SELECT
  2. concat(
  3. 'trades,instrument=', rnd_str(2,2,0),
  4. ',side=', rnd_str('B', 'S'),
  5. ' price=', abs(cast(rnd_double(0)*100000 AS INT)),
  6. ',quantity=', abs(cast(rnd_double(0)*10000 AS INT)),
  7. ' ',
  8. 1571270400000 + (x-1) * 100
  9. )
  10. FROM long_sequence(5) x;
  1. trades,instrument=CR,side=B price=70867,quantity=9192 1571270400000
  2. trades,instrument=LN,side=S price=37950,quantity=1439 1571270400100
  3. trades,instrument=ZJ,side=S price=82829,quantity=8871 1571270400200
  4. trades,instrument=EW,side=S price=10427,quantity=1945 1571270400300
  5. trades,instrument=MI,side=B price=99348,quantity=8450 1571270400400

length

length(string) - reads length of string value type (result is int)

length(symbol) - reads length of symbol value type (result is int)

length(blob) - reads length of binary value type (result is long)

  • a string
  • a symbol
  • a binary blob
  1. SELECT name a, length(name) b FROM names limit 4
ab
AARON5
AMELIE6
TOM3
null-1

~

string ~ regex - matches string value to regex

symbol ~ regex - matches symbol value to regex

java.util.regex

!~

string !~ regex - checks if string value does not match regex

symbol !~ regex - checks if symbol value does not match regex

to_lowercase

to_lowercase(string) - converts all string characters to lowercase

to_uppercase

to_uppercase(string) - converts all string characters to uppercase