Total Complexity | 1 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
10 | trait HasVirtualColumns |
||
11 | { |
||
12 | /** |
||
13 | * @var array|\Level23\Druid\VirtualColumns\VirtualColumnInterface[] |
||
14 | */ |
||
15 | protected $virtualColumns = []; |
||
16 | |||
17 | /** |
||
18 | * Create a virtual column. |
||
19 | * |
||
20 | * Virtual columns are queryable column "views" created from a set of columns during a query. |
||
21 | * |
||
22 | * A virtual column can potentially draw from multiple underlying columns, although a virtual column always |
||
23 | * presents itself as a single column. |
||
24 | * |
||
25 | * Virtual columns can be used as dimensions or as inputs to aggregators. |
||
26 | * |
||
27 | * NOTE: virtual columns are NOT automatically added to your output. You should select it separately if you want to |
||
28 | * add it also to your output. Use selectVirtual to do both at once. |
||
29 | * |
||
30 | * @param string $expression |
||
31 | * @param string $as |
||
32 | * @param string $outputType |
||
33 | * |
||
34 | * @return $this |
||
35 | * @see https://druid.apache.org/docs/latest/misc/math-expr.html |
||
36 | */ |
||
37 | 8 | public function virtualColumn(string $expression, string $as, $outputType = DataType::STRING) |
|
42 | } |
||
43 | } |