[teiid-issues] [JBoss JIRA] (TEIID-2141) create an objecttable table function

Steven Hawkins (JIRA) jira-events at lists.jboss.org
Thu Aug 23 14:51:14 EDT 2012


    [ https://issues.jboss.org/browse/TEIID-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713430#comment-12713430 ] 

Steven Hawkins commented on TEIID-2141:
---------------------------------------

The initial implementation is in.

The structure is similar to xmltable:

OBJECTTABLE([LANGUAGE lang] rowScript [PASSING val AS NAME ...] COLUMNS colName colType colScript [DEFAULT defaultExpr] ...) AS id

lang is a string identifying the language.  The default language is javascript as the is supported by the openjdk/sun jre as the RI for JSR-223.
rowScript is a string specifying the script to create the row values.  It can evaluate to an Iterator, Iteratable, or any other object, which will just be treated as an Iterator of a single item.
for each non-null item the Iterator produces the columns will be evaluated.
colName/colType are the id/data type of the column, which can optionally be defaulted.
colscript is a string specifying the script to get the column value.

In the script execution context we will place several special variables.  The CommandContext is available as teiid_context.  And the colScripts may access teiid_row, which is the row object produced by the row script, teiid_rowcount (although rownumber could also make sense) the current 1-based row count.

For example:

OBJECTTABLE('teiid_context' COLUMNS "user" string 'teiid_row.userName') AS x

Will retrieve the userName from the CommandContext using the default javascript language.  Since the row script evaluates to a non-iterator object, only a single row is processed.

If the language supports compiled scripts, the validator will attempt to pre-compile the scripts which assists with validation.

We'll also have to add special security handling for this as most scripting languages allow for unfettered java calls and shouldn't by default be open for use.
                
> create an objecttable table function
> ------------------------------------
>
>                 Key: TEIID-2141
>                 URL: https://issues.jboss.org/browse/TEIID-2141
>             Project: Teiid
>          Issue Type: Feature Request
>          Components: Query Engine
>            Reporter: Steven Hawkins
>            Assignee: Steven Hawkins
>             Fix For: 8.2
>
>
> Analogous to xmltable, we should offer an objecttable function to get values off of an object.  The choice of scripting/path language could even be configurable.  This would help eliminate some of the common complexity of relational-object translations and can be used to perform denoralization without a join - and could be first implemented to in databasemetadata views to speed up databasemetadata query processing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the teiid-issues mailing list