You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by gg...@apache.org on 2022/11/27 06:13:59 UTC
[asterixdb] branch master updated: [ASTERIXDB-3086][DOC] Adding SELECT-EXCLUDE to docs
This is an automated email from the ASF dual-hosted git repository.
ggalvizo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 44e655bfcb [ASTERIXDB-3086][DOC] Adding SELECT-EXCLUDE to docs
44e655bfcb is described below
commit 44e655bfcb5378e416c3135d10a3ff4740121ab5
Author: glennga <gg...@uci.edu>
AuthorDate: Thu Nov 17 19:25:12 2022 -0800
[ASTERIXDB-3086][DOC] Adding SELECT-EXCLUDE to docs
- user model changes: no
- storage format changes: no
- interface changes: no
details:
documenting the SELECT-EXCLUDE clause.
Change-Id: I7cc185e6e541e27ba5e4b44f36995e0d5d2ceedd
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17287
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Glenn Galvizo <gg...@uci.edu>
---
asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf | 2 +-
.../asterix-doc/src/main/markdown/sqlpp/3_query.md | 28 +++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf b/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
index 80f2bc2100..af67e33e00 100644
--- a/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
+++ b/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
@@ -59,7 +59,7 @@ QueryBlock ::= SelectClause ( ( LetClause WhereClause? ) | StreamGenerator )?
StreamGenerator::= FromClause LetClause? WhereClause? (GroupByClause LetClause? HavingClause?)?
-SelectClause ::= "SELECT" ("DISTINCT" | "ALL")? ( "VALUE" Expr | Projection ("," Projection)*)
+SelectClause ::= "SELECT" ("DISTINCT" | "ALL")? ( "VALUE" Expr | Projection ("," Projection)* ( "EXCLUDE" Identifier (("," | ".") Identifier)* )? )
Projection ::= (Expr ("AS"? Identifier)?) | (VariableRef "." "*") | "*"
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 04a65d1784..b8dc3bf658 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
@@ -248,7 +248,7 @@ The `DISTINCT` keyword is used to eliminate duplicate items from the results of
##### Example
-(Q3.5) Returns all of the different cities in the `customers` dataset.
+(Q3.5a) Returns all of the different cities in the `customers` dataset.
FROM customers AS c
SELECT DISTINCT c.address.city;
@@ -270,6 +270,32 @@ Result:
}
]
+### <a id="Select_exclude">SELECT EXCLUDE</a>
+The `EXCLUDE` keyword is used to remove one or more fields that would otherwise be returned from the `SELECT` clause.
+Conceptually, the scope of the `EXCLUDE` clause is the output of the `SELECT` clause itself.
+In a Stream Generator with both `DISTINCT` and `EXCLUDE` clauses, the `DISTINCT` clause is applied after the `EXCLUDE` clause.
+
+##### Example
+
+(Q3.5b) For the customer with `custid = C13`, return their information _excluding_ the `zipcode` field inside the `address` object and the top-level `name` field.
+
+ FROM customers AS c
+ WHERE c.custid = "C13"
+ SELECT c.* EXCLUDE address.zipcode, name;
+
+Result:
+
+ [
+ {
+ "custid": "C13",
+ "address": {
+ "street": "201 Main St.",
+ "city": "St. Louis, MO"
+ },
+ "rating": 750
+ }
+ ]
+
### <a id="Unnamed_projections">Unnamed Projections</a>
Similar to standard SQL, the query language supports unnamed projections (a.k.a, unnamed `SELECT` clause items), for which names are generated rather than user-provided.