...
- Structs: the elements within the type can be accessed using the DOT (.) notation. For example, for a column c of type STRUCT {a INT; b INT} the a field is accessed by the expression c.a
Maps (key-value tuples): The elements are accessed using \ ['element name'\] notation. For example in a map M comprising of a mapping from 'group' \ -> gid the gid value can be accessed using M\['group'\]Wiki Markup Arrays (indexable lists): The elements in the array have to be in the same type. Elements can be accessed using the \ [n\] notation where n is an index (zero-based) into the array. For example for an array A having the elements \ ['a', 'b', 'c'\], A\[1\] retruns 'b'.Wiki Markup
Using the primitive types and the constructs for creating complex types, types with arbitrary levels of nesting can be created. For example, a type User may comprise of the following fields:
...
Operator | Operand types | Description | |||||
---|---|---|---|---|---|---|---|
A[n] | A is an | <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b38c2466-209f-4299-b3f5-3eacff921e9f"><ac:plain-text-body><![CDATA[ | A[n] | A is an Array and n is an int | returns the nth element in the array A. The first element has index 0 e.g. if A is an array comprising of ['foo', 'bar'] then A[0] returns 'foo' and A[1] returns 'bar' | ]]></ac:plain-text-body></ac:structured-macro> | <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="fd92417b-c3b0-43df-a2aa-1ae6f9e10c6c"><ac:plain-text-body><![CDATA[ |
M[key] | M is a Map<K, V> and key has type K | returns the value corresponding to the key in the map e.g. if M is a map comprising of {'f' -> 'foo', 'b' -> 'bar', 'all' -> 'foobar'} then M['all'] returns 'foobar' ]]></ac:plain-text-body></ac:structured-macro> | |||||
S.x | S is a struct | returns the x field of S e.g for struct foobar {int foo, int bar} foobar.foo returns the integer stored in the foo field of the struct. |
...
Return Type | Aggregation Function Name (Signature) | Description | <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1f22a314-cfb5-4371-896f-57ebc9304260"><ac:plain-text-body><![CDATA[|
---|---|---|---|
BIGINT | count(*), count(expr), count(DISTINCT expr[, expr_.]) | count(*) - Returns the total number of retrieved rows, including rows containing NULL values; count(expr) - Returns the number of rows for which the supplied expression is non-NULL; count(DISTINCT expr[, expr]) - Returns the number of rows for which the supplied expression(s) are unique and non-NULL. ]]></ac:plain-text-body></ac:structured-macro> | |
DOUBLE | sum(col), sum(DISTINCT col) | returns the sum of the elements in the group or the sum of the distinct values of the column in the group | |
DOUBLE | avg(col), avg(DISTINCT col) | returns the average of the elements in the group or the average of the distinct values of the column in the group | |
DOUBLE | min(col) | returns the minimum value of the column in the group | |
DOUBLE | max(col) | returns the maximum value of the column in the group |
...