Dmitry Lychagin has submitted this change and it was merged. Change subject: [ASTERIXDB-2498][DOC] List slice documentation for SQL++ ......................................................................
[ASTERIXDB-2498][DOC] List slice documentation for SQL++ - user model changes: no - storage format changes: no - interface changes: no Details: - Added list slice syntax documentation. Change-Id: Iff9bb0e82f31cefcdd19ace0d02fc07e7d00025f Reviewed-on: https://asterix-gerrit.ics.uci.edu/3095 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Reviewed-by: Dmitry Lychagin <[email protected]> --- M asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md 1 file changed, 20 insertions(+), 13 deletions(-) Approvals: Jenkins: Verified; No violations found; ; Verified Dmitry Lychagin: Looks good to me, approved Objections: Anon. E. Moose #1000171: Violations found diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md index 41cf1d8..ef19dca 100644 --- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md +++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md @@ -208,21 +208,24 @@ PathExpression ::= PrimaryExpression ( Field | Index )* Field ::= "." Identifier - Index ::= "[" Expression "]" + Index ::= "[" Expression (":" ( Expression )? )? "]" -Components of complex types in the data model are accessed via path expressions. -Path access can be applied to the result of a query expression that yields an instance of a complex type, for example, a -object or array instance. -For objects, path access is based on field names. -For arrays, path access is based on (zero-based) array-style indexing. -Attempts to access non-existent fields or out-of-bound array elements produce the special value `MISSING`. -For multisets path access is also zero-based and returns an arbitrary multiset element if the index is within the size -of the multiset or `MISSING` otherwise. -Type errors will be raised for inappropriate use of a path expression, such as applying a field accessor to a numeric -value. +Components of complex types in the data model are accessed via path expressions. Path access can be applied to the +result of a query expression that yields an instance of a complex type, for example, an object or an array instance. -The following examples illustrate field access for a object, index-based element access for an array, and also a -composition thereof. +For objects, path access is based on field names, and it accesses the field whose name was specified.<br/> +For arrays, path access is based on (zero-based) array-style indexing. Array indexes can be used to retrieve either a +single element from an array, or a whole subset of an array. Accessing a single element is achieved by +providing a single index argument (zero-based element position), while obtaining a subset of an array is achieved by +providing the `start` and `end` (zero-based) index positions; the returned subset is from position `start` to position +`end - 1`; the `end` position argument is optional. Multisets have similar behavior to arrays, except for retrieving +arbitrary items as the order of items is not fixed in multisets. + +Attempts to access non-existent fields or out-of-bound array elements produce the special value `MISSING`. Type errors +will be raised for inappropriate use of a path expression, such as applying a field accessor to a numeric value. + +The following examples illustrate field access for an object, index-based element access or subset retrieval of an array, +and also a composition thereof. ##### Examples @@ -232,6 +235,10 @@ ({"name": "MyABCs", "array": [ "a", "b", "c"]}).array[2] + (["a", "b", "c"])[0:2] + + (["a", "b", "c"])[0:] + ## <a id="Primary_expressions">Primary Expressions</a> -- To view, visit https://asterix-gerrit.ics.uci.edu/3095 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iff9bb0e82f31cefcdd19ace0d02fc07e7d00025f Gerrit-PatchSet: 4 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Hussain Towaileb <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Dmitry Lychagin <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]>
