Skip to content

Instantly share code, notes, and snippets.

@raghavsethi
Created September 14, 2017 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raghavsethi/0367fa185e7d07bc2734e8bc093ad5c4 to your computer and use it in GitHub Desktop.
Save raghavsethi/0367fa185e7d07bc2734e8bc093ad5c4 to your computer and use it in GitHub Desktop.
Documentation fixups
diff --git a/presto-docs/src/main/sphinx/sql/deallocate-prepare.rst b/presto-docs/src/main/sphinx/sql/deallocate-prepare.rst
index eab8f305ab..806d345cbb 100644
--- a/presto-docs/src/main/sphinx/sql/deallocate-prepare.rst
+++ b/presto-docs/src/main/sphinx/sql/deallocate-prepare.rst
@@ -13,14 +13,12 @@ Description
-----------
Removes a statement with the name ``statement_name`` from the list of prepared
-statements for a session.
+statements in a session.
Examples
--------
-Deallocate a statement with the name ``my_query``:
-
-.. code-block:: sql
+Deallocate a statement with the name ``my_query``::
DEALLOCATE PREPARE my_query;
diff --git a/presto-docs/src/main/sphinx/sql/describe-input.rst b/presto-docs/src/main/sphinx/sql/describe-input.rst
index 76b4340c6a..6d654bafb0 100644
--- a/presto-docs/src/main/sphinx/sql/describe-input.rst
+++ b/presto-docs/src/main/sphinx/sql/describe-input.rst
@@ -12,8 +12,8 @@ Synopsis
Description
-----------
-Describes the input parameters for a prepared statement. It returns a table
-with the position and type of each parameter. Parameter types that cannot be
+Lists the input parameters of a prepared statement along with the
+position and type of each parameter. Parameter types that cannot be
determined will appear as ``unknown``.
Examples
@@ -28,16 +28,16 @@ Prepare and describe a query with three parameters:
.. code-block:: sql
- DESCRIBE INPUT my_select1;
+ DESCRIBE INPUT my_select1;
.. code-block:: none
- Position | Type
- ------------------
- 0 | unknown
- 1 | bigint
- 2 | varchar
- (3 rows)
+ Position | Type
+ --------------------
+ 0 | unknown
+ 1 | bigint
+ 2 | varchar
+ (3 rows)
Prepare and describe a query with no parameters:
@@ -48,13 +48,13 @@ Prepare and describe a query with no parameters:
.. code-block:: sql
- DESCRIBE INPUT my_select2;
+ DESCRIBE INPUT my_select2;
.. code-block:: none
- Position | Type
- ---------------
- (0 rows)
+ Position | Type
+ -----------------
+ (0 rows)
See Also
--------
diff --git a/presto-docs/src/main/sphinx/sql/describe-output.rst b/presto-docs/src/main/sphinx/sql/describe-output.rst
index 4e2f356168..b9533a335e 100644
--- a/presto-docs/src/main/sphinx/sql/describe-output.rst
+++ b/presto-docs/src/main/sphinx/sql/describe-output.rst
@@ -12,18 +12,14 @@ Synopsis
Description
-----------
-Describes the output columns of a prepared statement. It returns a table
-containing metadata for output columns of a prepared statement. For each
-output column, the column name (or alias), catalog, schema, table, type,
-type size in bytes, and a boolean indicating if the column is aliased is
-returned.
+List the output columns of a prepared statement, including the
+column name (or alias), catalog, schema, table, type, type size in
+bytes, and a boolean indicating if the column is aliased.
Examples
--------
-Prepare and describe a query with four output columns:
-
-.. code-block:: sql
+Prepare and describe a query with four output columns::
PREPARE my_select1 FROM
SELECT * FROM nation
@@ -34,17 +30,15 @@ Prepare and describe a query with four output columns:
.. code-block:: none
- Column Name | Catalog | Schema | Table | Type | Type Size | Aliased
- -------------+---------+--------+--------+---------+-----------+---------
- nationkey | tpch | sf1 | nation | bigint | 8 | false
- name | tpch | sf1 | nation | varchar | 0 | false
- regionkey | tpch | sf1 | nation | bigint | 8 | false
- comment | tpch | sf1 | nation | varchar | 0 | false
- (4 rows)
+ Column Name | Catalog | Schema | Table | Type | Type Size | Aliased
+ -------------+---------+--------+--------+---------+-----------+---------
+ nationkey | tpch | sf1 | nation | bigint | 8 | false
+ name | tpch | sf1 | nation | varchar | 0 | false
+ regionkey | tpch | sf1 | nation | bigint | 8 | false
+ comment | tpch | sf1 | nation | varchar | 0 | false
+ (4 rows)
-Prepare and describe a query whose output columns are expressions:
-
-.. code-block:: sql
+Prepare and describe a query whose output columns are expressions::
PREPARE my_select2 FROM
SELECT count(*) as my_count, 1+2 FROM nation
@@ -55,15 +49,13 @@ Prepare and describe a query whose output columns are expressions:
.. code-block:: none
- Column Name | Catalog | Schema | Table | Type | Type Size | Aliased
- -------------+---------+--------+-------+--------+-----------+---------
- my_count | | | | bigint | 8 | true
- _col1 | | | | bigint | 8 | false
- (2 rows)
-
-Prepare and describe a row count query:
+ Column Name | Catalog | Schema | Table | Type | Type Size | Aliased
+ -------------+---------+--------+-------+--------+-----------+---------
+ my_count | | | | bigint | 8 | true
+ _col1 | | | | bigint | 8 | false
+ (2 rows)
-.. code-block:: sql
+Prepare and describe a row count query::
PREPARE my_create FROM
CREATE TABLE foo AS SELECT * FROM nation
diff --git a/presto-docs/src/main/sphinx/sql/execute.rst b/presto-docs/src/main/sphinx/sql/execute.rst
index 06af535935..dfb00c8064 100644
--- a/presto-docs/src/main/sphinx/sql/execute.rst
+++ b/presto-docs/src/main/sphinx/sql/execute.rst
@@ -18,9 +18,7 @@ are defined in the ``USING`` clause.
Examples
--------
-Prepare and execute a query with no parameters:
-
-.. code-block:: sql
+Prepare and execute a query with no parameters::
PREPARE my_select1 FROM
SELECT name FROM nation;
@@ -29,22 +27,18 @@ Prepare and execute a query with no parameters:
EXECUTE my_select1;
-Prepare and execute a query with two parameters:
-
-.. code-block:: sql
+Prepare and execute a query with two parameters::
- PREPARE my_select2 FROM
- SELECT name FROM nation WHERE regionkey = ? and nationkey < ?;
+ PREPARE my_select2 FROM
+ SELECT name FROM nation WHERE regionkey = ? and nationkey < ?;
.. code-block:: sql
EXECUTE my_select2 USING 1, 3;
-This is equivalent to:
-
-.. code-block:: sql
+This is equivalent to::
- SELECT name FROM nation WHERE regionkey = 1 AND nationkey < 3;
+ SELECT name FROM nation WHERE regionkey = 1 AND nationkey < 3;
See Also
--------
diff --git a/presto-docs/src/main/sphinx/sql/prepare.rst b/presto-docs/src/main/sphinx/sql/prepare.rst
index 7ba4f7635c..7979a9870d 100644
--- a/presto-docs/src/main/sphinx/sql/prepare.rst
+++ b/presto-docs/src/main/sphinx/sql/prepare.rst
@@ -13,36 +13,29 @@ Description
-----------
Prepares a statement for execution at a later time. Prepared statements are
-queries that are saved on a per-session basis with a given name. The statement
-can include parameters in place of literals to be replaced at execution time.
+queries that are saved in a session with a given name. The statement can
+include parameters in place of literals to be replaced at execution time.
Parameters are represented by question marks.
Examples
--------
-Prepare a select query:
-
-.. code-block:: sql
+Prepare a select query::
PREPARE my_select1 FROM
SELECT * FROM nation;
Prepare a select query that includes parameters. The values to compare with
-``regionkey`` and ``nationkey`` will be filled in with the :doc:`execute` statement:
-
-.. code-block:: sql
+``regionkey`` and ``nationkey`` will be filled in with the :doc:`execute` statement::
PREPARE my_select2 FROM
SELECT name FROM nation WHERE regionkey = ? AND nationkey < ?;
-Prepare an insert query:
-
-.. code-block:: sql
+Prepare an insert query::
PREPARE my_insert FROM
INSERT INTO cities VALUES (1, 'San Francisco');
-
See Also
--------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment