You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by dl...@apache.org on 2018/12/19 21:11:04 UTC

asterixdb git commit: [ASTERIXDB-2498][DOC] List slice documentation for SQL++

Repository: asterixdb
Updated Branches:
  refs/heads/master 11c83fae1 -> 0ee48d0bd


[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 <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/0ee48d0b
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/0ee48d0b
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/0ee48d0b

Branch: refs/heads/master
Commit: 0ee48d0bdcc19ea4959ba9a26defef41530b1b7a
Parents: 11c83fa
Author: Hussain Towaileb <Hu...@Gmail.com>
Authored: Wed Dec 19 19:58:32 2018 +0300
Committer: Dmitry Lychagin <dm...@couchbase.com>
Committed: Wed Dec 19 13:10:42 2018 -0800

----------------------------------------------------------------------
 .../src/main/markdown/sqlpp/2_expr.md           | 37 ++++++++++++--------
 1 file changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0ee48d0b/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
----------------------------------------------------------------------
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 @@ A type error will be raised if the first expression in a quantified expression d
 
     PathExpression  ::= PrimaryExpression ( Field | Index )*
     Field           ::= "." Identifier
-    Index           ::= "[" 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.
-
-The following examples illustrate field access for a object, index-based element access for an array, and also a
-composition thereof.
+    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, an object or an array instance.
+
+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 @@ composition thereof.
 
     ({"name": "MyABCs", "array": [ "a", "b", "c"]}).array[2]
 
+    (["a", "b", "c"])[0:2]
+
+    (["a", "b", "c"])[0:]
+
 
 ## <a id="Primary_expressions">Primary Expressions</a>