You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org> on 2016/11/24 00:48:38 UTC
Change in asterixdb[master]: Polish the SQL++ reference doc.
Yingyi Bu has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1358
Change subject: Polish the SQL++ reference doc.
......................................................................
Polish the SQL++ reference doc.
Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
---
M asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
M asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
2 files changed, 41 insertions(+), 24 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/58/1358/1
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 f3d4311..3fb3121 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
@@ -286,9 +286,8 @@
FloatLiteral ::= <DIGITS> ( "f" | "F" )
| <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?
| "." <DIGITS> ( "f" | "F" )
- DoubleLiteral ::= <DIGITS>
- | <DIGITS> ( "." <DIGITS> )?
- | "." <DIGITS>
+ DoubleLiteral ::= <DIGITS> "." <DIGITS>
+ | "." <DIGITS>
Literals (constants) in SQL++ can be strings, integers, floating point values, double values, boolean constants, or special constant values like `NULL` and `MISSING`. The `NULL` value is like a `NULL` in SQL; it is used to represent an unknown field value. The specialy value `MISSING` is only meaningful in the context of SQL++ field accesses; it occurs when the accessed field simply does not exist at all in a object being accessed.
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
index dc760ba..ed4a8d0 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
@@ -96,6 +96,19 @@
### <a id="Select_element">SELECT VALUE Clause</a>
The `SELECT VALUE` clause in SQL++ returns a collection that contains the results of evaluating the `VALUE` expression, with one evaluation being performed per "binding tuple" (i.e., per `FROM` clause item) satisfying the statement's selection criteria.
For historical reasons SQL++ also allows the keywords `ELEMENT` or `RAW` to be used in place of `VALUE` (not recommended).
+
+The following example shows a standard-alone SELECT.
+
+##### Example
+
+ SELECT VALUE 1;
+
+This query return:
+
+ [
+ 1
+ ]
+
The following example shows a query that selects one user from the GleambookUsers collection.
##### Example
@@ -745,9 +758,10 @@
##### Example
- SELECT uid, (SELECT VALUE m.msg FROM msgs m) AS msgs
- FROM GleambookMessages message
- GROUP BY message.authorId AS uid GROUP AS msgs(message AS msg);
+ SELECT uid, (SELECT VALUE g.msg FROM g) AS msgs
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId AS uid
+ GROUP AS g(gbm as msg);
This variant of the example query returns:
@@ -835,9 +849,10 @@
##### Example
- SELECT uid, msg AS msgs
- FROM GleambookMessages message
- GROUP BY message.authorId AS uid GROUP AS msgs(message AS msg);
+ SELECT uid, msg AS msgs
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId AS uid
+ GROUP AS g(gbm as msg);
This variant of the query exploits a bit of SQL-style "syntactic sugar" that SQL++ offers to shorten some user queries.
In particular, in the `SELECT` list, the reference to the `GROUP` variable field `msg` -- because it references a field of the group variable -- is allowed but is "pluralized". As a result, the `msg` reference in the `SELECT` list is
@@ -849,13 +864,14 @@
##### Example
SELECT uid,
- (SELECT VALUE m.msg
- FROM msgs m
- WHERE m.msg.message LIKE '% like%'
- ORDER BY m.msg.messageId
+ (SELECT VALUE g.msg
+ FROM g
+ WHERE g.msg.message LIKE '% like%'
+ ORDER BY g.msg.messageId
LIMIT 2) AS msgs
- FROM GleambookMessages message
- GROUP BY message.authorId AS uid GROUP AS msgs(message AS msg);
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId AS uid
+ GROUP AS g(gbm as msg);
This example query returns:
@@ -912,14 +928,15 @@
##### Example
- SELECT authorId,
- (SELECT VALUE g.msg
- FROM g
- WHERE g.msg.message LIKE '% like%'
- ORDER BY g.msg.messageId
- LIMIT 2) AS msgs
- FROM GleambookMessages gbm
- GROUP BY gbm.authorId GROUP AS g(gbm as msg);
+ SELECT authorId,
+ (SELECT VALUE g.msg
+ FROM g
+ WHERE g.msg.message LIKE '% like%'
+ ORDER BY g.msg.messageId
+ LIMIT 2) AS msgs
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId
+ GROUP AS g(gbm as msg);
This query returns:
@@ -1020,7 +1037,7 @@
### <a id="Aggregation_functions">Aggregation functions</a>
In traditional SQL, which doesn't support nested data, grouping always also involves the use of aggregation
-compute properties of the groups (e.g., the average number of messages per user rather than the actual set
+to compute properties of the groups (e.g., the average number of messages per user rather than the actual set
of messages per user).
Each aggregation function in SQL++ takes a collection (e.g., the group of messages) as its input and produces
a scalar value as its output.
@@ -1548,6 +1565,7 @@
| Feature | SQL++ | SQL-92 | Why different? |
|----------|--------|-------|------------------|
| SELECT * | Returns nested objects | Returns flattened concatenated objects | Nested collections are 1st class citizens |
+| SELECT list | order not preserved | order preserved | Fields in a JSON object is not ordered |
| Subquery | Returns a collection | The returned collection is cast into a scalar value if the subquery appears in a SELECT list or on one side of a comparison or as input to a function | Nested collections are 1st class citizens |
| LEFT OUTER JOIN | Fills in `MISSING`(s) for non-matches | Fills in `NULL`(s) for non-matches | "Absence" is more appropriate than "unknown" here. |
| UNION ALL | Allows heterogeneous inputs and output | Input streams must be UNION-compatible and output field names are drawn from the first input stream | Heterogenity and nested collections are common |
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 3:
Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3355/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 3:
Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1169/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 1:
Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3353/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Yingyi Bu has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 2:
(3 comments)
https://asterix-gerrit.ics.uci.edu/#/c/1358/2/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
File asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md:
Line 761: SELECT uid, (SELECT VALUE g.msg FROM g) AS msgs
> Why this indentation change?
Done
Line 852: SELECT uid, msg AS msgs
> Why this indentation change?
Done
Line 931: SELECT authorId,
> Why this indentation change?
Done
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: Yes
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 2: Integration-Tests+1
Integration Tests Successful
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1168/ : SUCCESS
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Till Westmann (Code Review)" <do...@asterixdb.incubator.apache.org>.
Till Westmann has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Till Westmann (Code Review)" <do...@asterixdb.incubator.apache.org>.
Till Westmann has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 2:
(3 comments)
https://asterix-gerrit.ics.uci.edu/#/c/1358/2/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
File asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md:
Line 761: SELECT uid, (SELECT VALUE g.msg FROM g) AS msgs
Why this indentation change?
Line 852: SELECT uid, msg AS msgs
Why this indentation change?
Line 931: SELECT authorId,
Why this indentation change?
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: Yes
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Yingyi Bu has uploaded a new patch set (#2).
Change subject: Polish the SQL++ reference doc.
......................................................................
Polish the SQL++ reference doc.
Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
---
M asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
M asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
2 files changed, 41 insertions(+), 24 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/58/1358/2
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,
I'd like you to reexamine a change. Please visit
https://asterix-gerrit.ics.uci.edu/1358
to look at the new patch set (#3).
Change subject: Polish the SQL++ reference doc.
......................................................................
Polish the SQL++ reference doc.
Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
---
M asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
M asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
2 files changed, 38 insertions(+), 21 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/58/1358/3
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 3:
Integration Tests Successful
https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1169/ : SUCCESS
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Yingyi Bu has submitted this change and it was merged.
Change subject: Polish the SQL++ reference doc.
......................................................................
Polish the SQL++ reference doc.
Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1358
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
---
M asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
M asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
2 files changed, 38 insertions(+), 21 deletions(-)
Approvals:
Till Westmann: Looks good to me, approved
Jenkins: Verified; No 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 f3d4311..3fb3121 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/2_expr.md
@@ -286,9 +286,8 @@
FloatLiteral ::= <DIGITS> ( "f" | "F" )
| <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?
| "." <DIGITS> ( "f" | "F" )
- DoubleLiteral ::= <DIGITS>
- | <DIGITS> ( "." <DIGITS> )?
- | "." <DIGITS>
+ DoubleLiteral ::= <DIGITS> "." <DIGITS>
+ | "." <DIGITS>
Literals (constants) in SQL++ can be strings, integers, floating point values, double values, boolean constants, or special constant values like `NULL` and `MISSING`. The `NULL` value is like a `NULL` in SQL; it is used to represent an unknown field value. The specialy value `MISSING` is only meaningful in the context of SQL++ field accesses; it occurs when the accessed field simply does not exist at all in a object being accessed.
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
index dc760ba..b90eb06 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
@@ -96,6 +96,19 @@
### <a id="Select_element">SELECT VALUE Clause</a>
The `SELECT VALUE` clause in SQL++ returns a collection that contains the results of evaluating the `VALUE` expression, with one evaluation being performed per "binding tuple" (i.e., per `FROM` clause item) satisfying the statement's selection criteria.
For historical reasons SQL++ also allows the keywords `ELEMENT` or `RAW` to be used in place of `VALUE` (not recommended).
+
+The following example shows a standard-alone `SELECT VALUE`, which wraps a value into an array.
+
+##### Example
+
+ SELECT VALUE 1;
+
+This query return:
+
+ [
+ 1
+ ]
+
The following example shows a query that selects one user from the GleambookUsers collection.
##### Example
@@ -745,9 +758,10 @@
##### Example
- SELECT uid, (SELECT VALUE m.msg FROM msgs m) AS msgs
- FROM GleambookMessages message
- GROUP BY message.authorId AS uid GROUP AS msgs(message AS msg);
+ SELECT uid, (SELECT VALUE g.msg FROM g) AS msgs
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId AS uid
+ GROUP AS g(gbm as msg);
This variant of the example query returns:
@@ -836,8 +850,9 @@
##### Example
SELECT uid, msg AS msgs
- FROM GleambookMessages message
- GROUP BY message.authorId AS uid GROUP AS msgs(message AS msg);
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId AS uid
+ GROUP AS g(gbm as msg);
This variant of the query exploits a bit of SQL-style "syntactic sugar" that SQL++ offers to shorten some user queries.
In particular, in the `SELECT` list, the reference to the `GROUP` variable field `msg` -- because it references a field of the group variable -- is allowed but is "pluralized". As a result, the `msg` reference in the `SELECT` list is
@@ -849,13 +864,14 @@
##### Example
SELECT uid,
- (SELECT VALUE m.msg
- FROM msgs m
- WHERE m.msg.message LIKE '% like%'
- ORDER BY m.msg.messageId
+ (SELECT VALUE g.msg
+ FROM g
+ WHERE g.msg.message LIKE '% like%'
+ ORDER BY g.msg.messageId
LIMIT 2) AS msgs
- FROM GleambookMessages message
- GROUP BY message.authorId AS uid GROUP AS msgs(message AS msg);
+ FROM GleambookMessages gbm
+ GROUP BY gbm.authorId AS uid
+ GROUP AS g(gbm as msg);
This example query returns:
@@ -913,13 +929,14 @@
##### Example
SELECT authorId,
- (SELECT VALUE g.msg
- FROM g
- WHERE g.msg.message LIKE '% like%'
- ORDER BY g.msg.messageId
- LIMIT 2) AS msgs
+ (SELECT VALUE g.msg
+ FROM g
+ WHERE g.msg.message LIKE '% like%'
+ ORDER BY g.msg.messageId
+ LIMIT 2) AS msgs
FROM GleambookMessages gbm
- GROUP BY gbm.authorId GROUP AS g(gbm as msg);
+ GROUP BY gbm.authorId
+ GROUP AS g(gbm as msg);
This query returns:
@@ -1020,7 +1037,7 @@
### <a id="Aggregation_functions">Aggregation functions</a>
In traditional SQL, which doesn't support nested data, grouping always also involves the use of aggregation
-compute properties of the groups (e.g., the average number of messages per user rather than the actual set
+to compute properties of the groups (e.g., the average number of messages per user rather than the actual set
of messages per user).
Each aggregation function in SQL++ takes a collection (e.g., the group of messages) as its input and produces
a scalar value as its output.
@@ -1548,6 +1565,7 @@
| Feature | SQL++ | SQL-92 | Why different? |
|----------|--------|-------|------------------|
| SELECT * | Returns nested objects | Returns flattened concatenated objects | Nested collections are 1st class citizens |
+| SELECT list | order not preserved | order preserved | Fields in a JSON object is not ordered |
| Subquery | Returns a collection | The returned collection is cast into a scalar value if the subquery appears in a SELECT list or on one side of a comparison or as input to a function | Nested collections are 1st class citizens |
| LEFT OUTER JOIN | Fills in `MISSING`(s) for non-matches | Fills in `NULL`(s) for non-matches | "Absence" is more appropriate than "unknown" here. |
| UNION ALL | Allows heterogeneous inputs and output | Input streams must be UNION-compatible and output field names are drawn from the first input stream | Heterogenity and nested collections are common |
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 2:
Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1168/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: No
Change in asterixdb[master]: Polish the SQL++ reference doc.
Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.
Change subject: Polish the SQL++ reference doc.
......................................................................
Patch Set 2:
Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3354/
--
To view, visit https://asterix-gerrit.ics.uci.edu/1358
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb3cc23ebbf9e390d6eabf9386b15550aa5d6d43
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No