Skip to content

StarRocks

StarRocks SQL uses backtick-quoted identifiers, regexp() for regex, and -> with JSON-stringified keys for JSON access.

FlyQLGenerated SQL
message='hello'`message` = 'hello'
message!='hello'`message` != 'hello'
count>10`count` > 10
count<=100`count` <= 100
message~'error.*'regexp(`message`, 'error.*')
message!~'test.*'not regexp(`message`, 'test.*')
host=prod*`host` LIKE 'prod%'
FlyQLGenerated SQL
a='1' and b>10(`a` = '1' and `b` > 10)
a='1' or b='2'(`a` = '1' or `b` = '2')
not a='1'not (`a` = '1')
FlyQLGenerated SQL
status in [200, 201]`status` IN (200, 201)
env not in ['dev', 'test']`env` NOT IN ('dev', 'test')
status in []0
status not in []1

The has operator generates different SQL depending on the column type:

Column TypeFlyQLGenerated SQL
Stringmessage has 'error'INSTR(`message`, 'error') > 0
String (negated)message not has 'error'(`message` IS NULL OR INSTR(`message`, 'error') = 0)
Arraytags has 'web'array_contains(`tags`, 'web')
Array (negated)tags not has 'web'NOT array_contains(`tags`, 'web')
Mapmetadata has 'key'array_contains(map_keys(`metadata`), 'key')
Map (negated)metadata not has 'key'NOT array_contains(map_keys(`metadata`), 'key')
Native JSONdata has 'key'json_exists(`data`, concat('$.', 'key'))

StarRocks supports two JSON column types with different SQL output.

Native JSON columns use the -> operator with JSON-stringified keys:

FlyQLGenerated SQL
data.name='test'`data`->'\"name\"' = 'test'
data.user.name='john'`data`->'\"user\"'->'\"name\"' = 'john'

Columns storing JSON as a string require parse_json() before traversal:

FlyQLGenerated SQL
data.name='test'parse_json(`data`)->'\"name\"' = 'test'
data.user.name='john'parse_json(`data`)->'\"user\"'->'\"name\"' = 'john'

Map columns use bracket notation with direct comparison:

FlyQLGenerated SQL
metadata.key1='value1'`metadata`['key1'] = 'value1'
metadata.key1!='value1'`metadata`['key1'] != 'value1'
metadata.nested.key='value'`metadata`['nested']['key'] = 'value'
metadata.pattern~'test.*'`metadata`['pattern'] regexp 'test.*'

Array columns use 0-based bracket indexing:

FlyQLGenerated SQL
tags.0='first'`tags`[0] = 'first'
tags.1='second'`tags`[1] = 'second'

The jsonString parameter controls which mode is used (same as ClickHouse):

// Go
columns := map[string]*starrocks.Column{
"message": starrocks.NewColumn("message", false, "VARCHAR(255)", nil),
"data": starrocks.NewColumn("data", false, "JSON", nil), // native JSON
"log": starrocks.NewColumn("log", true, "STRING", nil), // JSON string
}
// JavaScript
const columns = {
message: newColumn("message", false, "VARCHAR(255)", null),
data: newColumn("data", false, "JSON", null), // native JSON
log: newColumn("log", true, "STRING", null), // JSON string
}