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 2021/01/27 01:07:53 UTC

[asterixdb] 07/11: [NO ISSUE][DOC][COMP] Document inline type syntax

This is an automated email from the ASF dual-hosted git repository.

dlych pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 0ebc4200ceeeccf87e26d0280004a825a9360753
Author: Dmitry Lychagin <dm...@couchbase.com>
AuthorDate: Mon Jan 25 13:12:41 2021 -0800

    [NO ISSUE][DOC][COMP] Document inline type syntax
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Document inline type syntax in CREATE DATASET
    - Update FunctionSignature documentation in DROP FUNCTION
    - Remove documentation source files that are no longer used
    - Remove unused CompactionPolicy production from  the grammar
    
    Change-Id: I75223beef3321d1e34de9a407691718669c52fb7
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9725
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
    Reviewed-by: Ian Maxon <im...@uci.edu>
---
 asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf  |  50 ++--
 .../src/main/markdown/sqlpp/3_declare_dataverse.md |  33 ---
 .../src/main/markdown/sqlpp/3_declare_function.md  |  45 ----
 .../asterix-doc/src/main/markdown/sqlpp/4_error.md | 113 --------
 .../src/main/markdown/sqlpp/4_error_title.md       |  20 --
 .../src/main/markdown/sqlpp/5_ddl_dataset_index.md | 296 ---------------------
 .../src/main/markdown/sqlpp/5_ddl_dml.md           |  92 -------
 .../main/markdown/sqlpp/5_ddl_function_removal.md  | 120 ---------
 .../src/main/markdown/sqlpp/5_ddl_head.md          |  36 ---
 .../src/main/markdown/sqlpp/7_ddl_dml.md           |  48 +++-
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj    |  13 +-
 11 files changed, 65 insertions(+), 801 deletions(-)

diff --git a/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf b/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
index 886efc9..62d333a 100644
--- a/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
+++ b/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
@@ -161,26 +161,38 @@ ObjectTypeDef ::= ("CLOSED" | "OPEN")? "{" ObjectField ("," ObjectField)* "}"
 ObjectField ::= Identifier ":" Identifier "?"?
 
 TypeExpr ::= ObjectTypeDef
-            |ArrayTypeDef
-            |MultisetTypeDef
-            |TypeRef
+            | ArrayTypeDef
+            | MultisetTypeDef
+            | TypeReference
 
 ArrayTypeDef ::= "[" TypeExpr "]"
 
 MultisetTypeDef ::= "{{" TypeExpr "}}"
 
-TypeRef ::= Identifier
+TypeReference ::= QualifiedName
 
 CreateDataset ::= CreateInternalDataset | CreateExternalDataset
 
-CreateInternalDataset ::= ( "INTERNAL" )? "DATASET" QualifiedName "(" QualifiedName ")" ("IF" "NOT" "EXISTS")?
-                           PrimaryKey ( "ON" Identifier )? ( "HINTS" Properties )?
-                           ( "USING" "COMPACTION" "POLICY" CompactionPolicy ( Configuration )? )?
-                           ( "WITH" "FILTER" "ON" Identifier )?
+CreateInternalDataset ::= ( "INTERNAL" )? "DATASET" QualifiedName DatasetTypeDef ( "WITH" "META"  DatasetTypeDef )?
+                            ("IF" "NOT" "EXISTS")?
+                            PrimaryKey
+                            ( "HINTS" Properties )?
+                            ( "WITH" "FILTER" "ON" NestedField )?
+                            ( "WITH" ObjectConstructor )?
 
-CreateExternalDataset ::= "EXTERNAL" "DATASET" QualifiedName "(" QualifiedName ")" ("IF" "NOT" "EXISTS")? "USING" AdapterName
-                           Configuration ( "HINTS" Properties )?
-                           ( "USING" "COMPACTION" "POLICY" CompactionPolicy ( Configuration )? )?
+CreateExternalDataset ::= "EXTERNAL" "DATASET" QualifiedName DatasetTypeDef
+                            ("IF" "NOT" "EXISTS")?
+                            "USING" AdapterName Configuration
+                            ( "HINTS" Properties )?
+                            ( "WITH" ObjectConstructor )?
+
+DatasetTypeDef ::= DatasetReferenceTypeDef | DatasetObjectTypeDef
+
+DatasetReferenceTypeDef ::= "(" TypeReference ")"
+
+DatasetObjectTypeDef ::= "(" DatasetObjectField ("," DatasetObjectField )* ")" ( ("CLOSED" | "OPEN") "TYPE" )?
+
+DatasetObjectField ::= Identifier TypeReference ("NOT" "UNKNOWN")?
 
 AdapterName ::= Identifier
 
@@ -194,8 +206,6 @@ PrimaryKey ::= "PRIMARY" "KEY" NestedField ( "," NestedField )* ("AUTOGENERATED"
 
 NestedField ::= Identifier ( "." Identifier )*
 
-CompactionPolicy ::= Identifier
-
 CreateIndex ::= CreateSecondaryIndex | CreatePrimaryKeyIndex
 
 CreateSecondaryIndex ::= "CREATE" ("INDEX" Identifier ("IF" "NOT" "EXISTS")? "ON" QualifiedName
@@ -203,7 +213,7 @@ CreateSecondaryIndex ::= "CREATE" ("INDEX" Identifier ("IF" "NOT" "EXISTS")? "ON
 
 CreatePrimaryKeyIndex ::=  "CREATE" "PRIMARY" "INDEX" Identifier? ("IF" "NOT" "EXISTS")? "ON" QualifiedName ("TYPE" "BTREE")?
 
-IndexField ::= NestedField (":" TypeRef)?
+IndexField ::= NestedField (":" TypeReference)?
 
 IndexType ::= "BTREE"
              |"RTREE"
@@ -212,19 +222,19 @@ IndexType ::= "BTREE"
 
 CreateSynonym ::= "CREATE" "SYNONYM" QualifiedName "FOR" QualifiedName ("IF" "NOT" "EXISTS")?
 
-FunctionParameters ::= "(" ("VARIABLE" (":" TypeExpr)? ("," "VARIABLE" (":" TypeExpr)? )* )? ")"
+CreateFunction ::= "CREATE" ("OR" "REPLACE")? "FUNCTION" QualifiedName ("IF" "NOT" "EXISTS")? FunctionParameters
+                  ( ("{" Expr "}") | ExternalFunctionDef)
 
+FunctionParameters ::= "(" ("VARIABLE" (":" TypeExpr)? ("," "VARIABLE" (":" TypeExpr)? )* )? ")"
 
-CreateFunction ::= "CREATE" ("OR" "REPLACE")? "FUNCTION" FunctionOrTypeName ("IF" "NOT" "EXISTS")? FunctionParameters ( "RETURNS" TypeExpr)?
-                   ( ("{" Expr "}") | ("AS" FunctionExternalIdentifier "AT" QualifiedName ("WITH" ObjectConstructor)?))
+ExternalFunctionDef ::= ("RETURNS" TypeExpr)? "AS" StringLiteral ("," StringLiteral )* "AT" QualifiedName ("WITH" ObjectConstructor)?
 
 DropStmnt ::= "DROP" ("DATAVERSE" Identifier
-                     | "TYPE" FunctionOrTypeName
-                     | ("DATSET" | "SYNONYM") QualifiedName
+                     | ("TYPE" |"DATASET" | "SYNONYM") QualifiedName
                      | "INDEX" DoubleQualifiedName
                      | "FUNCTION" FunctionSignature ) ("IF" "EXISTS")?
 
-FunctionSignature ::= FunctionOrTypeName "@" IntegerLiteral
+FunctionSignature ::= QualifiedName ( FunctionParameters | ( "(" IntegerLiteral ")" ) | ("@" IntegerLiteral) )
 
 LoadStmnt ::= "LOAD" "DATASET" QualifiedName "USING" AdapterName Configuration ("PRE-SORTED")?
 
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_declare_dataverse.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_declare_dataverse.md
deleted file mode 100644
index d33d680..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_declare_dataverse.md
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-## <a id="Declarations">Declarations</a>
-
-    DatabaseDeclaration ::= "USE" Identifier
-
-At the uppermost level, the world of data is organized into data namespaces called **dataverses**.
-To set the default dataverse for statements, the USE statement is provided.
-
-As an example, the following statement sets the default dataverse to be "TinySocial".
-
-##### Example
-
-    USE TinySocial;
-
-
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_declare_function.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_declare_function.md
deleted file mode 100644
index 8e77de9..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_declare_function.md
+++ /dev/null
@@ -1,45 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-When writing a complex query, it can sometimes be helpful to define one or more auxilliary functions
-that each address a sub-piece of the overall query.
-The declare function statement supports the creation of such helper functions.
-In general, the function body (expression) can be any legal query expression.
-
-    FunctionDeclaration  ::= "DECLARE" "FUNCTION" Identifier ParameterList "{" Expression "}"
-    ParameterList        ::= "(" ( <VARIABLE> ( "," <VARIABLE> )* )? ")"
-
-The following is a simple example of a temporary function definition and its use.
-
-##### Example
-
-    DECLARE FUNCTION friendInfo(userId) {
-        (SELECT u.id, u.name, len(u.friendIds) AS friendCount
-         FROM GleambookUsers u
-         WHERE u.id = userId)[0]
-     };
-
-    SELECT VALUE friendInfo(2);
-
-For our sample data set, this returns:
-
-    [
-      { "id": 2, "name": "IsbelDull", "friendCount": 2 }
-    ]
-
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/4_error.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/4_error.md
deleted file mode 100644
index 18fce14..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/4_error.md
+++ /dev/null
@@ -1,113 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-A query can potentially result in one of the following errors:
-
- * syntax error,
- * identifier resolution error,
- * type error,
- * resource error.
-
-If the query processor runs into any error, it will
-terminate the ongoing processing of the query and
-immediately return an error message to the client.
-
-## <a id="Syntax_errors">Syntax Errors</a>
-A valid query must satisfy the grammar rules of the query language.
-Otherwise, a syntax error will be raised.
-
-##### Example
-
-    SELECT *
-    GleambookUsers user
-
-Since the query misses a `FROM` keyword before the dataset `GleambookUsers`,
-we will get a syntax error as follows:
-
-    Syntax error: In line 2 >>GleambookUsers user;<< Encountered <IDENTIFIER> \"GleambookUsers\" at column 1.
-
-##### Example
-
-    SELECT *
-    FROM GleambookUsers user
-    WHERE type="advertiser";
-
-Since "type" is a reserved keyword in the query parser,
-we will get a syntax error as follows:
-
-    Error: Syntax error: In line 3 >>WHERE type="advertiser";<< Encountered 'type' "type" at column 7.
-    ==> WHERE type="advertiser";
-
-
-## <a id="Identifier_resolution_errors">Identifier Resolution Errors</a>
-Referring to an undefined identifier can cause an error if the identifier
-cannot be successfully resolved as a valid field access.
-
-##### Example
-
-    SELECT *
-    FROM GleambookUser user;
-
-If we have a typo as above in "GleambookUsers" that misses the dataset name's ending "s",
-we will get an identifier resolution error as follows:
-
-    Error: Cannot find dataset GleambookUser in dataverse Default nor an alias with name GleambookUser!
-
-##### Example
-
-    SELECT name, message
-    FROM GleambookUsers u JOIN GleambookMessages m ON m.authorId = u.id;
-
-If the compiler cannot figure out how to resolve an unqualified field name, which will occur if there is more than one variable in scope (e.g., `GleambookUsers u` and `GleambookMessages m` as above),
-we will get an identifier resolution error as follows:
-
-    Error: Cannot resolve ambiguous alias reference for undefined identifier name
-
-
-## <a id="Type_errors">Type Errors</a>
-
-The query compiler does type checks based on its available type information.
-In addition, the query runtime also reports type errors if a data model instance
-it processes does not satisfy the type requirement.
-
-##### Example
-
-    abs("123");
-
-Since function `abs` can only process numeric input values,
-we will get a type error as follows:
-
-    Error: Type mismatch: function abs expects its 1st input parameter to be of type tinyint, smallint, integer, bigint, float or double, but the actual input type is string
-
-
-## <a id="Resource_errors">Resource Errors</a>
-A query can potentially exhaust system resources, such
-as the number of open files and disk spaces.
-For instance, the following two resource errors could be potentially
-be seen when running the system:
-
-    Error: no space left on device
-    Error: too many open files
-
-The "no space left on device" issue usually can be fixed by
-cleaning up disk spaces and reserving more disk spaces for the system.
-The "too many open files" issue usually can be fixed by a system
-administrator, following the instructions
-[here](https://easyengine.io/tutorials/linux/increase-open-files-limit/).
-
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/4_error_title.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/4_error_title.md
deleted file mode 100644
index 6279d5e..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/4_error_title.md
+++ /dev/null
@@ -1,20 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-# <a id="Errors">4. Errors</a>
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dataset_index.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dataset_index.md
deleted file mode 100644
index 9e10aed..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dataset_index.md
+++ /dev/null
@@ -1,296 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-## <a id="Lifecycle_management_statements">Lifecycle Management Statements</a>
-
-    CreateStatement ::= "CREATE" ( DatabaseSpecification
-                                 | TypeSpecification
-                                 | DatasetSpecification
-                                 | IndexSpecification
-                                 | SynonymSpecification
-                                 | FunctionSpecification )
-
-    QualifiedName       ::= Identifier ( "." Identifier )?
-    DoubleQualifiedName ::= Identifier "." Identifier ( "." Identifier )?
-
-The CREATE statement is used for creating dataverses as well as other persistent artifacts in a dataverse.
-It can be used to create new dataverses, datatypes, datasets, indexes, and user-defined query functions.
-
-### <a id="Dataverses"> Dataverses</a>
-
-    DatabaseSpecification ::= "DATAVERSE" Identifier IfNotExists
-
-The CREATE DATAVERSE statement is used to create new dataverses.
-To ease the authoring of reusable query scripts, an optional IF NOT EXISTS clause is included to allow
-creation to be requested either unconditionally or only if the dataverse does not already exist.
-If this clause is absent, an error is returned if a dataverse with the indicated name already exists.
-
-The following example creates a new dataverse named TinySocial if one does not already exist.
-
-##### Example
-
-    CREATE DATAVERSE TinySocial IF NOT EXISTS;
-
-### <a id="Types"> Types</a>
-
-    TypeSpecification    ::= "TYPE" FunctionOrTypeName IfNotExists "AS" ObjectTypeDef
-    FunctionOrTypeName   ::= QualifiedName
-    IfNotExists          ::= ( <IF> <NOT> <EXISTS> )?
-    TypeExpr             ::= ObjectTypeDef | TypeReference | ArrayTypeDef | MultisetTypeDef
-    ObjectTypeDef        ::= ( <CLOSED> | <OPEN> )? "{" ( ObjectField ( "," ObjectField )* )? "}"
-    ObjectField          ::= Identifier ":" ( TypeExpr ) ( "?" )?
-    NestedField          ::= Identifier ( "." Identifier )*
-    IndexField           ::= NestedField ( ":" TypeReference )?
-    TypeReference        ::= Identifier
-    ArrayTypeDef         ::= "[" ( TypeExpr ) "]"
-    MultisetTypeDef      ::= "{{" ( TypeExpr ) "}}"
-
-The CREATE TYPE statement is used to create a new named datatype.
-This type can then be used to create stored collections or utilized when defining one or more other datatypes.
-Much more information about the data model is available in the [data model reference guide](../datamodel.html).
-A new type can be a object type, a renaming of another type, an array type, or a multiset type.
-A object type can be defined as being either open or closed.
-Instances of a closed object type are not permitted to contain fields other than those specified in the create type statement.
-Instances of an open object type may carry additional fields, and open is the default for new types if neither option is specified.
-
-The following example creates a new object type called GleambookUser type.
-Since it is defined as (defaulting to) being an open type,
-instances will be permitted to contain more than what is specified in the type definition.
-The first four fields are essentially traditional typed name/value pairs (much like SQL fields).
-The friendIds field is a multiset of integers.
-The employment field is an array of instances of another named object type, EmploymentType.
-
-##### Example
-
-    CREATE TYPE GleambookUserType AS {
-      id:         int,
-      alias:      string,
-      name:       string,
-      userSince: datetime,
-      friendIds: {{ int }},
-      employment: [ EmploymentType ]
-    };
-
-The next example creates a new object type, closed this time, called MyUserTupleType.
-Instances of this closed type will not be permitted to have extra fields,
-although the alias field is marked as optional and may thus be NULL or MISSING in legal instances of the type.
-Note that the type of the id field in the example is UUID.
-This field type can be used if you want to have this field be an autogenerated-PK field.
-(Refer to the Datasets section later for more details on such fields.)
-
-##### Example
-
-    CREATE TYPE MyUserTupleType AS CLOSED {
-      id:         uuid,
-      alias:      string?,
-      name:       string
-    };
-
-### <a id="Datasets"> Datasets</a>
-
-    DatasetSpecification ::= ( <INTERNAL> )? <DATASET> QualifiedName "(" QualifiedName ")" IfNotExists
-                               PrimaryKey ( <ON> Identifier )? ( <HINTS> Properties )?
-                               ( "USING" "COMPACTION" "POLICY" CompactionPolicy ( Configuration )? )?
-                               ( <WITH> <FILTER> <ON> Identifier )?
-                              |
-                               <EXTERNAL> <DATASET> QualifiedName "(" QualifiedName ")" IfNotExists <USING> AdapterName
-                               Configuration ( <HINTS> Properties )?
-                               ( <USING> <COMPACTION> <POLICY> CompactionPolicy ( Configuration )? )?
-    AdapterName          ::= Identifier
-    Configuration        ::= "(" ( KeyValuePair ( "," KeyValuePair )* )? ")"
-    KeyValuePair         ::= "(" StringLiteral "=" StringLiteral ")"
-    Properties           ::= ( "(" Property ( "," Property )* ")" )?
-    Property             ::= Identifier "=" ( StringLiteral | IntegerLiteral )
-    FunctionSignature    ::= FunctionOrTypeName "@" IntegerLiteral
-    PrimaryKey           ::= <PRIMARY> <KEY> NestedField ( "," NestedField )* ( <AUTOGENERATED> )?
-    CompactionPolicy     ::= Identifier
-
-The CREATE DATASET statement is used to create a new dataset.
-Datasets are named, multisets of object type instances;
-they are where data lives persistently and are the usual targets for queries.
-Datasets are typed, and the system ensures that their contents conform to their type definitions.
-An Internal dataset (the default kind) is a dataset whose content lives within and is managed by the system.
-It is required to have a specified unique primary key field which uniquely identifies the contained objects.
-(The primary key is also used in secondary indexes to identify the indexed primary data objects.)
-
-Internal datasets contain several advanced options that can be specified when appropriate.
-One such option is that random primary key (UUID) values can be auto-generated by declaring the field to be UUID and putting "AUTOGENERATED" after the "PRIMARY KEY" identifier.
-In this case, unlike other non-optional fields, a value for the auto-generated PK field should not be provided at insertion time by the user since each object's primary key field value will be auto-generated by the system.
-
-Another advanced option, when creating an Internal dataset, is to specify the merge policy to control which of the
-underlying LSM storage components to be merged.
-(The system supports Log-Structured Merge tree based physical storage for Internal datasets.)
-Currently the system supports four different component merging policies that can be chosen per dataset:
-no-merge, constant, prefix, and correlated-prefix.
-The no-merge policy simply never merges disk components.
-The constant policy merges disk components when the number of components reaches a constant number k that can be configured by the user.
-The prefix policy relies on both component sizes and the number of components to decide which components to merge.
-It works by first trying to identify the smallest ordered (oldest to newest) sequence of components such that the sequence does not contain a single component that exceeds some threshold size M and that either the sum of the component's sizes exceeds M or the number of components in the sequence exceeds another threshold C.
-If such a sequence exists, the components in the sequence are merged together to form a single component.
-Finally, the correlated-prefix policy is similar to the prefix policy, but it delegates the decision of merging the disk components of all the indexes in a dataset to the primary index.
-When the correlated-prefix policy decides that the primary index needs to be merged (using the same decision criteria as for the prefix policy), then it will issue successive merge requests on behalf of all other indexes associated with the same dataset.
-The system's default policy is the prefix policy except when there is a filter on a dataset, where the preferred policy for filters is the correlated-prefix.
-
-Another advanced option shown in the syntax above, related to performance and mentioned above, is that a **filter** can optionally be created on a field to further optimize range queries with predicates on the filter's field.
-Filters allow some range queries to avoid searching all LSM components when the query conditions match the filter.
-(Refer to [Filter-Based LSM Index Acceleration](../filters.html) for more information about filters.)
-
-An External dataset, in contrast to an Internal dataset, has data stored outside of the system's control.
-Files living in HDFS or in the local filesystem(s) of a cluster's nodes are currently supported.
-External dataset support allows queries to treat foreign data as though it were stored in the system,
-making it possible to query "legacy" file data (for example, Hive data) without having to physically import it.
-When defining an External dataset, an appropriate adapter type must be selected for the desired external data.
-(See the [Guide to External Data](../externaldata.html) for more information on the available adapters.)
-
-The following example creates an Internal dataset for storing FacefookUserType objects.
-It specifies that their id field is their primary key.
-
-#### Example
-
-    CREATE INTERNAL DATASET GleambookUsers(GleambookUserType) PRIMARY KEY id;
-
-The next example creates another Internal dataset (the default kind when no dataset kind is specified) for storing MyUserTupleType objects.
-It specifies that the id field should be used as the primary key for the dataset.
-It also specifies that the id field is an auto-generated field,
-meaning that a randomly generated UUID value should be assigned to each incoming object by the system.
-(A user should therefore not attempt to provide a value for this field.)
-Note that the id field's declared type must be UUID in this case.
-
-#### Example
-
-    CREATE DATASET MyUsers(MyUserTupleType) PRIMARY KEY id AUTOGENERATED;
-
-The next example creates an External dataset for querying LineItemType objects.
-The choice of the `hdfs` adapter means that this dataset's data actually resides in HDFS.
-The example CREATE statement also provides parameters used by the hdfs adapter:
-the URL and path needed to locate the data in HDFS and a description of the data format.
-
-#### Example
-
-    CREATE EXTERNAL DATASET LineItem(LineItemType) USING hdfs (
-      ("hdfs"="hdfs://HOST:PORT"),
-      ("path"="HDFS_PATH"),
-      ("input-format"="text-input-format"),
-      ("format"="delimited-text"),
-      ("delimiter"="|"));
-
-
-### <a id="Indices">Indices</a>
-
-    IndexSpecification ::= (<INDEX> Identifier IfNotExists <ON> QualifiedName
-                           "(" ( IndexField ) ( "," IndexField )* ")" (<TYPE> IndexType)? (<ENFORCED>)?)
-                           |
-                           <PRIMARY> <INDEX> Identifier? IfNotExists <ON> QualifiedName (<TYPE> <BTREE>)?
-    IndexType          ::= <BTREE> | <RTREE> | <KEYWORD> | <NGRAM> "(" IntegerLiteral ")"
-
-The CREATE INDEX statement creates a secondary index on one or more fields of a specified dataset.
-Supported index types include `BTREE` for totally ordered datatypes, `RTREE` for spatial data,
-and `KEYWORD` and `NGRAM` for textual (string) data.
-An index can be created on a nested field (or fields) by providing a valid path expression as an index field identifier.
-
-An indexed field is not required to be part of the datatype associated with a dataset if the dataset's datatype
-is declared as open **and** if the field's type is provided along with its name and if the `ENFORCED` keyword is
-specified at the end of the index definition.
-`ENFORCING` an open field introduces a check that makes sure that the actual type of the indexed field
-(if the optional field exists in the object) always matches this specified (open) field type.
-
-The following example creates a btree index called gbAuthorIdx on the authorId field of the GleambookMessages dataset.
-This index can be useful for accelerating exact-match queries, range search queries, and joins involving the author-id
-field.
-
-#### Example
-
-    CREATE INDEX gbAuthorIdx ON GleambookMessages(authorId) TYPE BTREE;
-
-The following example creates an open btree index called gbSendTimeIdx on the (non-declared) `sendTime` field of the GleambookMessages dataset having datetime type.
-This index can be useful for accelerating exact-match queries, range search queries, and joins involving the `sendTime` field.
-The index is enforced so that records that do not have the `sendTime` field or have a mismatched type on the field
-cannot be inserted into the dataset.
-
-#### Example
-
-    CREATE INDEX gbSendTimeIdx ON GleambookMessages(sendTime: datetime?) TYPE BTREE ENFORCED;
-
-The following example creates an open btree index called gbReadTimeIdx on the (non-declared) `readTime`
-field of the GleambookMessages dataset having datetime type.
-This index can be useful for accelerating exact-match queries, range search queries,
-and joins involving the `readTime` field.
-The index is not enforced so that records that do not have the `readTime` field or have a mismatched type on the field
-can still be inserted into the dataset.
-
-#### Example
-
-    CREATE INDEX gbReadTimeIdx ON GleambookMessages(readTime: datetime?);
-
-The following example creates a btree index called crpUserScrNameIdx on screenName,
-a nested field residing within a object-valued user field in the ChirpMessages dataset.
-This index can be useful for accelerating exact-match queries, range search queries,
-and joins involving the nested screenName field.
-Such nested fields must be singular, i.e., one cannot index through (or on) an array-valued field.
-
-#### Example
-
-    CREATE INDEX crpUserScrNameIdx ON ChirpMessages(user.screenName) TYPE BTREE;
-
-The following example creates an rtree index called gbSenderLocIdx on the sender-location field of the GleambookMessages dataset. This index can be useful for accelerating queries that use the [`spatial-intersect` function](functions.html#spatial-intersect) in a predicate involving the sender-location field.
-
-#### Example
-
-    CREATE INDEX gbSenderLocIndex ON GleambookMessages("sender-location") TYPE RTREE;
-
-The following example creates a 3-gram index called fbUserIdx on the name field of the GleambookUsers dataset. This index can be used to accelerate some similarity or substring maching queries on the name field. For details refer to the document on [similarity queries](similarity.html#NGram_Index).
-
-#### Example
-
-    CREATE INDEX fbUserIdx ON GleambookUsers(name) TYPE NGRAM(3);
-
-The following example creates a keyword index called fbMessageIdx on the message field of the GleambookMessages dataset. This keyword index can be used to optimize queries with token-based similarity predicates on the message field. For details refer to the document on [similarity queries](similarity.html#Keyword_Index).
-
-#### Example
-
-    CREATE INDEX fbMessageIdx ON GleambookMessages(message) TYPE KEYWORD;
-
-The following example creates a special secondary index which holds only the primary keys.
-This index is useful for speeding up aggregation queries which involve only primary keys.
-The name of the index is optional. If the name is not specified, the system will generate
-one. When the user would like to drop this index, the metadata can be queried to find the system-generated name.
-
-#### Example
-
-    CREATE PRIMARY INDEX gb_pk_idx ON GleambookMessages;
-
-An example query that can be accelerated using the primary-key index:
-
-    SELECT COUNT(*) FROM GleambookMessages;
-
-To look up the the above primary-key index, issue the following query:
-
-    SELECT VALUE i
-    FROM Metadata.`Index` i
-    WHERE i.DataverseName = "TinySocial" AND i.DatasetName = "GleambookMessages";
-
-The query returns:
-
-    [ { "DataverseName": "TinySocial", "DatasetName": "GleambookMessages", "IndexName": "GleambookMessages", "IndexStructure": "BTREE", "SearchKey": [ [ "messageId" ] ], "IsPrimary": true, "Timestamp": "Wed Nov 07 17:25:11 PST 2018", "PendingOp": 0 }
-    , { "DataverseName": "TinySocial", "DatasetName": "GleambookMessages", "IndexName": "gb_pk_idx", "IndexStructure": "BTREE", "SearchKey": [  ], "IsPrimary": false, "Timestamp": "Wed Nov 07 17:25:11 PST 2018", "PendingOp": 0 }
-     ]
-
-Remember that `CREATE PRIMARY INDEX` creates a secondary index.
-That is the reason the `IsPrimary` field is false.
-The primary-key index can be identified by the fact that the `SearchKey` field is empty since it only contains primary key fields.
\ No newline at end of file
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md
deleted file mode 100644
index 7a2223e..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md
+++ /dev/null
@@ -1,92 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-## <a id="Modification_statements">Modification statements</a>
-
-### <a id="Inserts">INSERTs</a>
-
-    InsertStatement ::= <INSERT> <INTO> QualifiedName Query
-
-The INSERT statement is used to insert new data into a dataset.
-The data to be inserted comes from a query expression.
-This expression can be as simple as a constant expression, or in general it can be any legal query.
-In case the dataset has an auto-generated primary key, when performing an INSERT operation, the system allows the user to manually add the
-auto-generated key field in the INSERT statement, or skip that field and the system will automatically generate it and add it. However,
-it is important to note that if the a record already exists in the dataset with the auto-generated key provided by the user, then
-that operation is going to fail. As a general rule, insertion will fail if the dataset already has data with the primary key value(s)
-being inserted.
-
-Inserts are processed transactionally by the system.
-The transactional scope of each insert transaction is the insertion of a single object plus its affiliated secondary index entries (if any).
-If the query part of an insert returns a single object, then the INSERT statement will be a single, atomic transaction.
-If the query part returns multiple objects, each object being inserted will be treated as a separate tranaction.
-
-The target dataset name may be a synonym introduced by CREATE SYNONYM statement.
-
-The following example illustrates a query-based insertion.
-
-##### Example
-
-    INSERT INTO UsersCopy (SELECT VALUE user FROM GleambookUsers user)
-
-### <a id="Upserts">UPSERTs</a>
-
-    UpsertStatement ::= <UPSERT> <INTO> QualifiedName Query
-
-The UPSERT statement syntactically mirrors the INSERT statement discussed above.
-The difference lies in its semantics, which for UPSERT are "add or replace" instead of the INSERT "add if not present, else error" semantics.
-Whereas an INSERT can fail if another object already exists with the specified key, the analogous UPSERT will replace the previous object's value
-with that of the new object in such cases. Like the INSERT statement, the system allows the user to manually provide the auto-generated key
-for datasets with an auto-generated key as its primary key. This operation will insert the record if no record with that key already exists, but
-if a record with the key already exists, then the operation will be converted to a replace/update operation.
-
-The target dataset name may be a synonym introduced by CREATE SYNONYM statement.
-
-The following example illustrates a query-based upsert operation.
-
-##### Example
-
-    UPSERT INTO UsersCopy (SELECT VALUE user FROM GleambookUsers user)
-
-*Editor's note: Upserts currently work in AQL but are not yet enabled (at the moment) in the current query language.
-
-### <a id="Deletes">DELETEs</a>
-
-    DeleteStatement ::= <DELETE> <FROM> QualifiedName ( ( <AS> )? Variable )? ( <WHERE> Expression )?
-
-The DELETE statement is used to delete data from a target dataset.
-The data to be deleted is identified by a boolean expression involving the variable bound to the target dataset in the DELETE statement.
-
-Deletes are processed transactionally by the system.
-The transactional scope of each delete transaction is the deletion of a single object plus its affiliated secondary index entries (if any).
-If the boolean expression for a delete identifies a single object, then the DELETE statement itself will be a single, atomic transaction.
-If the expression identifies multiple objects, then each object deleted will be handled as a separate transaction.
-
-The target dataset name may be a synonym introduced by CREATE SYNONYM statement.
-
-The following examples illustrate single-object deletions.
-
-##### Example
-
-    DELETE FROM GleambookUsers user WHERE user.id = 8;
-
-##### Example
-
-    DELETE FROM GleambookUsers WHERE id = 5;
-
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_function_removal.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_function_removal.md
deleted file mode 100644
index a0742a3..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_function_removal.md
+++ /dev/null
@@ -1,120 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-### <a id="Functions"> Functions</a>
-
-The CREATE FUNCTION statement creates a **named** function that can then be used and reused in queries.
-The body of a function can be any query expression involving the function's parameters.
-
-    FunctionSpecification ::= (<OR> <REPLACE>)? "FUNCTION" FunctionOrTypeName IfNotExists ParameterList "{" Expression "}"
-
-The following is an example of a CREATE FUNCTION statement which is similar to our earlier DECLARE FUNCTION example.
-It differs from that example in that it results in a function that is persistently registered by name in the specified dataverse (the current dataverse being used, if not otherwise specified).
-
-##### Example
-
-    CREATE FUNCTION friendInfo(userId) {
-        (SELECT u.id, u.name, len(u.friendIds) AS friendCount
-         FROM GleambookUsers u
-         WHERE u.id = userId)[0]
-     };
-
-The following is an example of CREATE FUNCTION statement that replaces an existing function.
-
-##### Example
-
-    CREATE OR REPLACE FUNCTION friendInfo(userId) {
-        (SELECT u.id, u.name
-         FROM GleambookUsers u
-         WHERE u.id = userId)[0]
-     };
-
-### <a id="Synonyms"> Synonyms</a>
-
-    SynonymSpecification ::= "SYNONYM" QualifiedName IfNotExists "FOR" QualifiedName 
-
-The CREATE SYNONYM statement creates a synonym for a given dataset.
-This synonym may be used used instead of the dataset name in SELECT, INSERT, UPSERT, DELETE, and LOAD statements.
-The target dataset does not need to exist when the synonym is created.
-
-##### Example
-
-    CREATE DATASET GleambookUsers(GleambookUserType) PRIMARY KEY id;
-
-    CREATE SYNONYM GleambookUsersSynonym FOR GleambookUsers;
-
-    SELECT * FROM GleambookUsersSynonym;
-
-More information on how synonyms are resolved can be found in the appendix section on Variable Resolution.
-
-### <a id="Removal"> Removal</a>
-
-    DropStatement       ::= "DROP" ( "DATAVERSE" Identifier IfExists
-                                   | "TYPE" FunctionOrTypeName IfExists
-                                   | "DATASET" QualifiedName IfExists
-                                   | "INDEX" DoubleQualifiedName IfExists
-                                   | "SYNONYM" QualifiedName IfExists
-                                   | "FUNCTION" FunctionSignature IfExists )
-    IfExists            ::= ( "IF" "EXISTS" )?
-
-The DROP statement is the inverse of the CREATE statement. It can be used to drop dataverses, datatypes, datasets, indexes, functions, and synonyms.
-
-The following examples illustrate some uses of the DROP statement.
-
-##### Example
-
-    DROP DATASET GleambookUsers IF EXISTS;
-
-    DROP INDEX GleambookMessages.gbSenderLocIndex;
-
-    DROP TYPE TinySocial2.GleambookUserType;
-
-    DROP FUNCTION friendInfo@1;
-
-    DROP SYNONYM GleambookUsersSynonym;
-
-    DROP DATAVERSE TinySocial;
-
-When an artifact is dropped, it will be droppped from the current dataverse if none is specified
-(see the DROP DATASET example above) or from the specified dataverse (see the DROP TYPE example above)
-if one is specified by fully qualifying the artifact name in the DROP statement.
-When specifying an index to drop, the index name must be qualified by the dataset that it indexes.
-When specifying a function to drop, since the query language allows functions to be overloaded by their number of arguments,
-the identifying name of the function to be dropped must explicitly include that information.
-(`friendInfo@1` above denotes the 1-argument function named friendInfo in the current dataverse.)
-
-### <a id="Load_statement">Load Statement</a>
-
-    LoadStatement  ::= <LOAD> <DATASET> QualifiedName <USING> AdapterName Configuration ( <PRE-SORTED> )?
-
-The LOAD statement is used to initially populate a dataset via bulk loading of data from an external file.
-An appropriate adapter must be selected to handle the nature of the desired external data.
-The LOAD statement accepts the same adapters and the same parameters as discussed earlier for External datasets.
-(See the [guide to external data](externaldata.html) for more information on the available adapters.)
-If a dataset has an auto-generated primary key field, the file to be imported should not include that field in it.
-
-The target dataset name may be a synonym introduced by CREATE SYNONYM statement.
-
-The following example shows how to bulk load the GleambookUsers dataset from an external file containing data that has been prepared in ADM (Asterix Data Model) format.
-
-##### Example
-
-     LOAD DATASET GleambookUsers USING localfs
-        (("path"="127.0.0.1:///Users/bignosqlfan/tinysocialnew/gbu.adm"),("format"="adm"));
-
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_head.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_head.md
deleted file mode 100644
index 83fa4c9..0000000
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_head.md
+++ /dev/null
@@ -1,36 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-
-# <a id="DDL_and_DML_statements">5. DDL and DML statements</a>
-
-    Statement ::= ( ( SingleStatement )? ( ";" )+ )* <EOF>
-    SingleStatement ::= DatabaseDeclaration
-                      | FunctionDeclaration
-                      | CreateStatement
-                      | DropStatement
-                      | LoadStatement
-                      | SetStatement
-                      | InsertStatement
-                      | DeleteStatement
-                      | Query
-
-In addition to queries, an implementation of the query language needs to support statements for data definition
-and manipulation purposes as well as controlling the context to be used in evaluating query expressions.
-This section details the DDL and DML statements supported in the query language as realized today in Apache AsterixDB.
-
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/7_ddl_dml.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/7_ddl_dml.md
index 0afa49c..8ed266f 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/7_ddl_dml.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/7_ddl_dml.md
@@ -128,8 +128,8 @@ The following example creates a new dataverse named `Commerce` if one does not a
 ### MultisetTypeDef
 **![](../images/diagrams/MultisetTypeDef.png)**
 
-### TypeRef
-**![](../images/diagrams/TypeRef.png)**
+### TypeReference
+**![](../images/diagrams/TypeReference.png)**
 
 ---
 
@@ -202,6 +202,27 @@ although the `ship_date` field is marked as optional and may thus be `NULL` or `
 ### CreateExternalDataset
 **![](../images/diagrams/CreateExternalDataset.png)**
 
+### DatasetTypeDef
+**![](../images/diagrams/DatasetTypeDef.png)**
+
+### DatasetReferenceTypeDef
+**![](../images/diagrams/DatasetReferenceTypeDef.png)**
+
+### DatasetObjectTypeDef
+**![](../images/diagrams/DatasetObjectTypeDef.png)**
+
+### DatasetObjectField
+**![](../images/diagrams/DatasetObjectField.png)**
+
+### TypeReference
+**![](../images/diagrams/TypeReference.png)**
+
+### PrimaryKey
+**![](../images/diagrams/PrimaryKey.png)**
+
+### NestedField
+**![](../images/diagrams/NestedField.png)**
+
 ### AdapterName
 **![](../images/diagrams/AdapterName.png)**
 
@@ -214,15 +235,6 @@ although the `ship_date` field is marked as optional and may thus be `NULL` or `
 ### Properties
 **![](../images/diagrams/Properties.png)**
 
-### PrimaryKey
-**![](../images/diagrams/PrimaryKey.png)**
-
-### NestedField
-**![](../images/diagrams/NestedField.png)**
-
-### CompactionPolicy
-**![](../images/diagrams/CompactionPolicy.png)**
-
 ---
 
 The `CREATE DATASET` statement is used to create a new dataset.
@@ -262,8 +274,8 @@ making it possible to query "legacy" file data (for example, Hive data) without
 When defining an External dataset, an appropriate adapter type must be selected for the desired external data.
 (See the [Guide to External Data](../aql/externaldata.html) for more information on the available adapters.)
 
-The following example creates an Internal dataset for storing FacefookUserType objects.
-It specifies that their id field is their primary key.
+The following example creates an Internal dataset for storing `customerType` objects.
+It specifies that their `custid` field is their primary key.
 
 #### Example
 
@@ -278,6 +290,12 @@ Note that the `itemno` field's declared type must be UUID in this case.
 
     CREATE DATASET MyItems(itemType) PRIMARY KEY itemno AUTOGENERATED;
 
+Alternatively the dataset object type can be specified using inline type definition syntax.
+
+#### Example
+
+    CREATE DATASET MyItems(itemno INT NOT UNKNOWN, qty INT NOT UNKNOWN, price INT NOT UNKNOWN) PRIMARY KEY itemno AUTOGENERATED;
+
 The next example creates an External dataset for querying LineItemType objects.
 The choice of the `hdfs` adapter means that this dataset's data actually resides in HDFS.
 The example `CREATE` statement also provides parameters used by the hdfs adapter:
@@ -469,6 +487,8 @@ The body of a function can be any query expression involving the function's para
 ### FunctionParameters
 **![](../images/diagrams/FunctionParameters.png)**
 
+### ExternalFunctionDef
+**![](../images/diagrams/ExternalFunctionDef.png)**
 
 ---
 The following is an example of a `CREATE FUNCTION` statement which is similar to our earlier `DECLARE FUNCTION` example.
@@ -537,7 +557,7 @@ if one is specified by fully qualifying the artifact name in the `DROP` statemen
 When specifying an index to drop, the index name must be qualified by the dataset that it indexes.
 When specifying a function to drop, since the query language allows functions to be overloaded by their number of arguments,
 the identifying name of the function to be dropped must explicitly include that information.
-(`nameSearch@1` above denotes the 1-argument function named nameSearch in the current dataverse.)
+(`nameSearch@1` above denotes the 1-argument function named `nameSearch` in the current dataverse.)
 
 ### <a id="Load_statement">Load Statement</a>
 
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 56f94ef..3d451ee 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -1123,17 +1123,6 @@ CreateIndexStatement PrimaryIndexSpecification(Token startStmtToken) throws Pars
   }
 }
 
-String CompactionPolicy() throws ParseException :
-{
-  String compactionPolicy = null;
-}
-{
-  compactionPolicy = Identifier()
-    {
-      return compactionPolicy;
-    }
-}
-
 String FilterField() throws ParseException :
 {
   String filterField = null;
@@ -4602,7 +4591,7 @@ TOKEN [IGNORE_CASE]:
   | <CASE : "case">
   | <CLOSED : "closed">
   | <CREATE : "create">
-  | <COMPACTION : "compaction">
+  | <COMPACTION : "compaction"> // no longer used
   | <COMPACT : "compact">
   | <CONNECT : "connect">
   | <CORRELATE : "correlate">