Virtual columns
Virtual columns are queryable column “views” created from a set of columns during a query.
A virtual column can potentially draw from multiple underlying columns, although a virtual column always presents itself as a single column.
Virtual columns can be referenced by their output names to be used as dimensions or as inputs to and aggregators.
Expression virtual columns use Druid’s native system to allow defining query time transforms of inputs from one or more columns.
The expression virtual column has the following syntax:
"type": "expression",
"name": <name of the virtual column>,
"outputType": <output value type of expression>
}
The nested field virtual column is an optimized virtual column that can provide direct access into various paths of a COMPLEX<json>
column, including using their indexes.
You can define a nested field virtual column with any of the following equivalent syntaxes. The examples all produce the same output value, with each example showing a different way to specify how to access the nested value. The first is using JSONPath syntax path
, the second with a jq path
, and the third uses pathParts
.
{
"type": "nested-field",
"columnName": "shipTo",
"outputName": "v1",
"path": ".phoneNumbers[1].number",
}
Nested path part
Specify pathParts
as an array of objects that describe each component of the path to traverse. Each object can take the following properties:
See Nested columns for more information on ingesting and storing nested data.
{
"type": "mv-filtered",
"name": "filteredDim3",
"delegate": "dim3",
"values": ["hello", "world"],
"isAllowList": true
}