Description
The following functions have been added:
(MB-31131)
LPAD( string , size [, padding-string ] )
RPAD( string , size [, padding-string ] )
Pad <string> to <size> using character(s) from <padding-string> or space if not specified. LPAD add characters at the start of the string, RPAD at the end.
e.g.
cbq> select lpad("hello",10),rpad("world",10,"!."); |
{
|
"requestID": "33fdd525-095d-4b32-913f-fa5aebae3224", |
"signature": { |
"$1": "string", |
"$2": "string" |
},
|
"results": [ |
{
|
"$1": " hello", |
"$2": "world!.!.!" |
}
|
],
|
...
|
(MB-43890)
OBJECT_PAIRS_NESTED( expression [, options] )
This is similar to the OBJECT_PAIRS() function however it flattens and reports all nested name-value pairs too.
<options> is an optional object with the possible fields:
"composites"
TRUE / FALSE (default) indicating whether or not the results should include values that will also be broken down further.
e.g. with the input expression result of:
{
|
"attribute" : { "first-part": 1, "second-part": 2} |
}
|
with "composites" set to TRUE, the results are:
[
|
{ "name": "attribute", "val": { "first-part": 1, "second-part": 2} }, |
{ "name": "first-part", "val": 1 }, |
{ "name": "second-part", "val": 2 } |
]
|
with "composites" set to FALSE, the results are:
[
|
{ "name": "first-part", "val": 1 }, |
{ "name": "second-part", "val": 2 } |
]
|
"pattern"
This is a regular expression that is used to filter returned name-value pairs. Only the name is matched against the pattern.
(MB-34609)
OBJECT_PATHS( expression [, options] )
This reports the names of all fields, including nested fields, in an object.
<options> is an optional object with the possible fields:
"composites"
TRUE (default) / FALSE indicating whether or not the results should include values that will also be broken down further.
e.g. with the input expression result of:
{
|
"attribute" : { "first-part": 1, "second-part": 2} |
}
|
with "composites" set to TRUE, the results are:
[
|
"attribute", |
"attribute.first-part", |
"attribute.second-part" |
]
|
with "composites" set to FALSE, the results are:
[
|
"attribute.first-part", |
"attribute.second-part" |
]
|
"arraysubscript"
TRUE (default) / FALSE indicating whether or not to include array subscripts in results.
e.g. with the input expression result of:
{
|
"attribute": [ { "name": "elem1"}, {"name": "elem2"}] |
}
|
with "arraysubscript" set to TRUE, the results are:
[
|
"attribute", |
"attribute[0].name", |
"attribute[1].name" |
]
|
with "arraysubscript" set to FALSE (and "unique" is set to FALSE), the results are:
[
|
"attribute", |
"attribute[*].name", |
"attribute[*].name" |
]
|
"unique"
TRUE (default) / FALSE indicating whether or not to report duplicated field names, typically when arrays are expanded and subscripting isn't being used.
"pattern"
This is a regular expression that is used to filter returned paths.
"patternspace"
String literal "field" indicating the pattern is matched against individual field names or "path" (default) indicating the pattern is matched against composite path names. e.g. with an object:
{
|
"attribute": { |
"name": "elem1" |
}
|
}
|
"field" will mean that the pattern is checked against "attribute" and "name"; "path" means it is checked against "attribute" and "attribute.name".
The following functions have been updated:
(MB-37371)
DATE_TRUNC_STR has had "week" and "iso_week" added to the permitted components list. Both truncate the date to the start of the week with "week" defining the start as Sunday and "iso_week" as Monday.
(MB-36680)
STR_TO_MILLIS now has an optional second parameter where the expected format of the input date-string can be specified following Golang rules.
https://golang.org/pkg/time/#pkg-constants
e.g.
cbq> SELECT STR_TO_MILLIS('19/08/2011 6:33:23+0000','02/01/2006 15:04:05Z0700'); |
{
|
"requestID": "c7f81d6d-11c6-4a01-9deb-1985e3a38da8", |
"signature": { |
"$1": "number" |
},
|
"results": [ |
{
|
"$1": 1313735603000 |
}
|
],
|