ASF GitHub Bot commented on HAWQ-1096:

Github user dyozie commented on a diff in the pull request:

    --- 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;
    +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;
    +gpadmin=# SELECT all_caps('change me');
    + all_caps  
    +(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."

> document the HAWQ built-in languages (SQL, C, internal)
> -------------------------------------------------------
>                 Key: HAWQ-1096
>                 URL: https://issues.apache.org/jira/browse/HAWQ-1096
>             Project: Apache HAWQ
>          Issue Type: Improvement
>          Components: Documentation
>            Reporter: Lisa Owen
>            Assignee: David Yozie
>            Priority: Minor
> the HAWQ docs do not discuss the built-in languages supported by HAWQ - SQL, 
> C and internal.  add content to introduce these languages with relevant 
> examples and links. 

This message was sent by Atlassian JIRA

Reply via email to