You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hawq.apache.org by lisakowen <gi...@git.apache.org> on 2016/10/18 17:20:02 UTC

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

GitHub user lisakowen opened a pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25

    HAWQ-1096 - add content for hawq built-in languages

    add content for sql, c, and internal hawq built in languages

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/lisakowen/incubator-hawq-docs feature/builtin-langs

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hawq-docs/pull/25.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #25
    
----
commit 504c662be21dc344a161b81a9c627a8f6d7861cd
Author: Lisa Owen <lo...@pivotal.io>
Date:   2016-10-05T21:33:36Z

    add file discussing hawq built-in languages

commit 8e27e9093f1d27277d676386144ee895ad004f86
Author: Lisa Owen <lo...@pivotal.io>
Date:   2016-10-05T21:34:36Z

    include built-in languages in PL lang landing page

commit bd85fdbc31cb463855c2606fde48d803dccb3de2
Author: Lisa Owen <lo...@pivotal.io>
Date:   2016-10-05T21:47:11Z

    c user-defined function example - add _c to function name to avoid confusion

commit 1332870d01d2f8da2f8284ac167253d7005c6dfd
Author: Lisa Owen <lo...@pivotal.io>
Date:   2016-10-10T22:24:20Z

    builtin langs -  clarify and add some links

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83978153
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    +
    +The following example creates and calls an SQL function to count the number of rows of the database named `orders`:
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION count_orders() RETURNS bigint AS $$
    + SELECT count(*) FROM orders;
    +$$ LANGUAGE SQL;
    +CREATE FUNCTION
    +gpadmin=# select count_orders();
    + my_count 
    +----------
    +   830513
    +(1 row)
    +```
    +
    +For additional information on creating SQL functions, refer to [Query Language (SQL) Functions](https://www.postgresql.org/docs/8.2/static/xfunc-sql.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>Internal
    +
    +Many HAWQ internal functions are written in C. These functions are declared during initialization of the database cluster and statically linked to the HAWQ server. See [Built-in Functions and Operators](../query/functions-operators.html#topic29) for detailed information on HAWQ internal functions.
    +
    +While users cannot define new internal functions, they can create aliases for existing internal functions.
    +
    +The following example creates a new function named `all_caps` that will be defined as an alias for the `upper` HAWQ internal function:
    +
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION all_caps (text) RETURNS text AS 'upper'
    +            LANGUAGE internal STRICT;
    +CREATE FUNCTION
    +gpadmin=# SELECT all_caps('change me');
    + all_caps  
    +-----------
    + CHANGE ME
    +(1 row)
    +
    +```
    +
    +For more information on aliasing internal functions, refer to [Internal Functions](https://www.postgresql.org/docs/8.2/static/xfunc-internal.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>C
    --- End diff --
    
    This id value is the same as the previous one - should be unique.  Also change header to "C Functions"?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83979056
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    +
    +The following example creates and calls an SQL function to count the number of rows of the database named `orders`:
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION count_orders() RETURNS bigint AS $$
    + SELECT count(*) FROM orders;
    +$$ LANGUAGE SQL;
    +CREATE FUNCTION
    +gpadmin=# select count_orders();
    + my_count 
    +----------
    +   830513
    +(1 row)
    +```
    +
    +For additional information on creating SQL functions, refer to [Query Language (SQL) Functions](https://www.postgresql.org/docs/8.2/static/xfunc-sql.html) in the PostgreSQL documentation.
    --- End diff --
    
    Global edit:  Change "For additional information on" to "For additional information about"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83977628
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    --- End diff --
    
    Global:  change "an SQL" to "a SQL" (pronounced 'sequel')


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-hawq-docs/pull/25


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83978465
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    +
    +The following example creates and calls an SQL function to count the number of rows of the database named `orders`:
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION count_orders() RETURNS bigint AS $$
    + SELECT count(*) FROM orders;
    +$$ LANGUAGE SQL;
    +CREATE FUNCTION
    +gpadmin=# select count_orders();
    + my_count 
    +----------
    +   830513
    +(1 row)
    +```
    +
    +For additional information on creating SQL functions, refer to [Query Language (SQL) Functions](https://www.postgresql.org/docs/8.2/static/xfunc-sql.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>Internal
    +
    +Many HAWQ internal functions are written in C. These functions are declared during initialization of the database cluster and statically linked to the HAWQ server. See [Built-in Functions and Operators](../query/functions-operators.html#topic29) for detailed information on HAWQ internal functions.
    +
    +While users cannot define new internal functions, they can create aliases for existing internal functions.
    --- End diff --
    
    Reword:  **You** cannot define new internal functions, **but you** can create...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83978854
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    +
    +The following example creates and calls an SQL function to count the number of rows of the database named `orders`:
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION count_orders() RETURNS bigint AS $$
    + SELECT count(*) FROM orders;
    +$$ LANGUAGE SQL;
    +CREATE FUNCTION
    +gpadmin=# select count_orders();
    + my_count 
    +----------
    +   830513
    +(1 row)
    +```
    +
    +For additional information on creating SQL functions, refer to [Query Language (SQL) Functions](https://www.postgresql.org/docs/8.2/static/xfunc-sql.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>Internal
    +
    +Many HAWQ internal functions are written in C. These functions are declared during initialization of the database cluster and statically linked to the HAWQ server. See [Built-in Functions and Operators](../query/functions-operators.html#topic29) for detailed information on HAWQ internal functions.
    +
    +While users cannot define new internal functions, they can create aliases for existing internal functions.
    +
    +The following example creates a new function named `all_caps` that will be defined as an alias for the `upper` HAWQ internal function:
    +
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION all_caps (text) RETURNS text AS 'upper'
    +            LANGUAGE internal STRICT;
    +CREATE FUNCTION
    +gpadmin=# SELECT all_caps('change me');
    + all_caps  
    +-----------
    + CHANGE ME
    +(1 row)
    +
    +```
    +
    +For more information on aliasing internal functions, refer to [Internal Functions](https://www.postgresql.org/docs/8.2/static/xfunc-internal.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>C
    +
    +User-defined functions written in C must be compiled into shared libraries to be loaded by the HAWQ server on demand. This dynamic loading distinguishes C language functions from internal functions that are written in C.
    --- End diff --
    
    Avoid passive voice here:  "You must compile user-defined functions written in C into shared libraries so that the HAWQ server can load them on demand."


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83976414
  
    --- Diff: plext/UsingProceduralLanguages.html.md.erb ---
    @@ -1,13 +1,16 @@
     ---
    -title: Using Procedural Languages and Extensions in HAWQ
    +title: Using Languages and Extensions in HAWQ
     ---
     
    -HAWQ allows user-defined functions to be written in other languages besides SQL and C. These other languages are generically called *procedural languages* (PLs).
    +HAWQ supports user-defined functions created with the SQL and C built-in languages, including supporting user-defined aliases for internal functions.
    --- End diff --
    
    This needs a bit of an edit:  HAWQ supports user-defined functions **that are** created with the SQL and C built-in languages, **and also supports** user-defined aliases for internal functions.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83978549
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    +
    +The following example creates and calls an SQL function to count the number of rows of the database named `orders`:
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION count_orders() RETURNS bigint AS $$
    + SELECT count(*) FROM orders;
    +$$ LANGUAGE SQL;
    +CREATE FUNCTION
    +gpadmin=# select count_orders();
    + my_count 
    +----------
    +   830513
    +(1 row)
    +```
    +
    +For additional information on creating SQL functions, refer to [Query Language (SQL) Functions](https://www.postgresql.org/docs/8.2/static/xfunc-sql.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>Internal
    +
    +Many HAWQ internal functions are written in C. These functions are declared during initialization of the database cluster and statically linked to the HAWQ server. See [Built-in Functions and Operators](../query/functions-operators.html#topic29) for detailed information on HAWQ internal functions.
    +
    +While users cannot define new internal functions, they can create aliases for existing internal functions.
    +
    +The following example creates a new function named `all_caps` that will be defined as an alias for the `upper` HAWQ internal function:
    --- End diff --
    
    Edit:  change "that will be defined as an" to "that is an"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-hawq-docs pull request #25: HAWQ-1096 - add content for hawq built...

Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq-docs/pull/25#discussion_r83978174
  
    --- Diff: plext/builtin_langs.html.md.erb ---
    @@ -0,0 +1,110 @@
    +---
    +title: Using HAWQ Built-In Languages
    +---
    +
    +This section provides an introduction to using the HAWQ built-in languages.
    +
    +HAWQ supports user-defined functions created with the SQL and C built-in languages. HAWQ also supports user-defined aliases for internal functions.
    +
    +
    +## <a id="enablebuiltin"></a>Enabling Built-in Language Support
    +
    +Support for SQL, internal, and C language user-defined functions is enabled by default for all HAWQ databases.
    +
    +## <a id="builtinsql"></a>SQL
    +
    +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query.
    +
    +The following example creates and calls an SQL function to count the number of rows of the database named `orders`:
    +
    +``` sql
    +gpadmin=# CREATE FUNCTION count_orders() RETURNS bigint AS $$
    + SELECT count(*) FROM orders;
    +$$ LANGUAGE SQL;
    +CREATE FUNCTION
    +gpadmin=# select count_orders();
    + my_count 
    +----------
    +   830513
    +(1 row)
    +```
    +
    +For additional information on creating SQL functions, refer to [Query Language (SQL) Functions](https://www.postgresql.org/docs/8.2/static/xfunc-sql.html) in the PostgreSQL documentation.
    +
    +## <a id="builtininternal"></a>Internal
    --- End diff --
    
    Change title to "Internal Functions"?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---