Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

More docs in reference manual and add architecture doc #417

Merged
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b3254e1
Initial commit for PartiQL and complex query docs
dai-chen Mar 18, 2020
17476dd
Merge branch 'master' into automated-docs-phase-3
dai-chen Mar 18, 2020
7db02d1
Initial commit for PartiQL and complex query docs
dai-chen Mar 18, 2020
d8001ab
Initial commit for PartiQL and complex query docs
dai-chen Mar 18, 2020
ece5c14
Ignore multi-query for now because of bug
dai-chen Mar 18, 2020
034575f
Add test index mappings
dai-chen Mar 18, 2020
09fc3e7
Fix partiql doc
dai-chen Mar 19, 2020
21662a2
Bypass LEFT JOIN for now
dai-chen Mar 19, 2020
73594db
Add doc for JOINs
dai-chen Mar 19, 2020
0a55357
Add doc for JOINs
dai-chen Mar 19, 2020
63db8c2
Add doc for JOINs
dai-chen Mar 23, 2020
1d5d8cd
Add more cases for PartiQL
dai-chen Mar 26, 2020
eb62303
Add more cases for PartiQL
dai-chen Mar 26, 2020
51235c6
Add multi-line support
dai-chen Mar 27, 2020
2637e8b
Add multi-line support
dai-chen Mar 27, 2020
72a549f
Multi-line all complex queries
dai-chen Mar 27, 2020
19a28f4
Multi-line all complex queries
dai-chen Mar 30, 2020
092e9fe
Add doc for full text search
dai-chen Mar 31, 2020
0675b80
Add doc for full text search
dai-chen Mar 31, 2020
6ad2538
Add doc for metadata query
dai-chen Mar 31, 2020
90058aa
Add doc for multi match query
dai-chen Mar 31, 2020
1cf14d9
Add doc for delete statement
dai-chen Mar 31, 2020
99793e3
Remove join explain
dai-chen Apr 2, 2020
ee51857
Add RDD
dai-chen Apr 2, 2020
4b20d56
Add RDD
dai-chen Apr 2, 2020
9a5d653
Print test data for PartiQL
dai-chen Apr 2, 2020
83077dd
Print test data for PartiQL
dai-chen Apr 3, 2020
593c012
Change titles
dai-chen Apr 6, 2020
beb0577
Add architecture doc
dai-chen Apr 7, 2020
f40c747
Merge branch 'master' into automated-docs-phase-3
dai-chen Apr 7, 2020
c4c7bc7
Add docs for SQL functions
dai-chen Apr 8, 2020
a1f3c6f
Update index
dai-chen Apr 8, 2020
3e88f5b
Update docs
dai-chen Apr 8, 2020
45e8db9
Merge branch 'master' into automated-docs-phase-3
dai-chen Apr 8, 2020
7b4998a
Update docs
dai-chen Apr 8, 2020
131d254
Update docs
dai-chen Apr 8, 2020
8d4f684
Address PR comments
dai-chen Apr 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initial commit for PartiQL and complex query docs
  • Loading branch information
dai-chen committed Mar 18, 2020
commit d8001abe2e8cba8af8ffbd5bc4c80a03157ff7f9
53 changes: 14 additions & 39 deletions docs/user/dql/complex.rst
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ Complex Query
Subqueries
==========

Example 1: IN/EXISTS
--------------------
Example: IN/EXISTS
------------------

SQL query::

@@ -45,45 +45,18 @@ Result set:
+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+


Example 2: Subqueries in FROM clause
------------------------------------

SQL query::

POST /_opendistro/_sql
{
"query" : "SELECT * FROM (SELECT * FROM accounts) AS a"
}

Explain::

{
"from" : 0,
"size" : 200
}

Result set:

+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+
|account_number|firstname|gender| city|balance|employer|state| email| address|lastname|age|
+==============+=========+======+======+=======+========+=====+========================+====================+========+===+
| 1| Amber| M|Brogan| 39225| Pyrami| IL| amberduke@pyrami.com| 880 Holmes Lane| Duke| 32|
+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+
| 6| Hattie| M| Dante| 5686| Netagy| TN| hattiebond@netagy.com| 671 Bristol Street| Bond| 36|
+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+
| 13| Nanette| F| Nogal| 32838| Quility| VA|nanettebates@quility.com| 789 Madison Street| Bates| 28|
+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+
| 18| Dale| M| Orick| 4180| null| MD| daleadams@boink.com|467 Hutchinson Court| Adams| 33|
+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+


Set Operations
==============

Example 1: UNION
----------------
Description
-----------

Set operations allow results of multiple queries to be combined into a single result set.

A ``UNION`` clause combines the results of two queries into a single result. Any duplicate record are removed unless ``UNION ALL`` is used. A common use case of ``UNION`` is to combine results from an index rotated on a daily or monthly basis.
Example 1: UNION Operator
-------------------------

A ``UNION`` clause combines the results of two queries into a single result set. Duplicate rows are removed unless ``UNION ALL`` clause is being used. A common use case of ``UNION`` is to combine result set from data partitioned in indices daily or monthly.

SQL query::

@@ -114,8 +87,10 @@ Result set:
+--------------+---------+------+------+-------+--------+-----+------------------------+--------------------+--------+---+


Example 2: MINUS
----------------
Example 2: MINUS Operator
-------------------------

A ``MINUS`` clause takes two queries too but returns resulting rows of first query that do not appear in the other query. Duplicate rows are removed automatically as well.

SQL query::

Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
@DocTestConfig(template = "beyond/partiql.rst", testData = {"employees_nested.json"})
public class PartiQLIT extends DocTest {

/*
@Section(1)
public void unnestingCollection() {
section(
@@ -56,7 +57,6 @@ public void unnestingUsingJoin() {
);
}

/*
@Section(3)
public void missing() {
section(
Original file line number Diff line number Diff line change
@@ -31,15 +31,16 @@ public void subqueries() {
title("IN/EXISTS"),
description(""),
post("SELECT * FROM accounts")
),
)/*,
example(
title("Subqueries in FROM clause"),
description(""),
post("SELECT * FROM (SELECT * FROM accounts) AS a")
)
)*/
);
}

/*
@Section(2)
public void joins() {
section(
@@ -57,7 +58,7 @@ public void joins() {
"by ``ON`` clause."
),
post(
"SELECT * FROM accounts a JOIN employees_nested e ON a.account_number = e.id"
"SELECT e.id FROM accounts a JOIN employees_nested e ON a.account_number = e.id"
)
),
example(
@@ -72,10 +73,11 @@ public void joins() {
"join predicate. For now, only ``LEFT OUTER JOIN`` is supported to retain rows from first index.",
"Keyword ``OUTER`` is optional."
),
post("SELECT * FROM accounts a LEFT JOIN employees_nested e ON a.account_number = e.id")
post("SELECT a.account_number FROM accounts a LEFT JOIN employees_nested e ON a.account_number = e.id")
)
);
}
*/

@Section(3)
public void setOperations() {