[teiid-issues] [JBoss JIRA] (TEIID-5977) There should be a way to push down a virtual function defined in ddl

Steven Hawkins (Jira) issues at jboss.org
Thu Jul 23 20:21:09 EDT 2020


    [ https://issues.redhat.com/browse/TEIID-5977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14292242#comment-14292242 ] 

Steven Hawkins commented on TEIID-5977:
---------------------------------------

inlining is possible, but involved.  it should be driven/controlled by a hint/option - never inline, aways inline, or only inline after pushdown (similar to our handling of things like concat2 where it's best to pushdown the original function rather than the compensation).
the static analysis of whether the function can be inlined should be done only once - that it's just a return statement with an expression.  The parameter expressions would need to be checked to see if anything is non-deterministic (or probably if it contains subcommands) and to disallow the inlining if the parameter is used multiple times in the expression (which could also be determined ahead of time).  The rewrite could then handle the appropriate expression mapping.

To match source functions there are a couple of possibilities.  One line of thought is that this is similar to the conformed source functionality, such that the virtual function could map to a specific source function that then declared it was conformed to a set of sources - this would effectively be two features conformed sources for functions and a mapping between a virtual function and a source function.  However that doesn't quite line up to the primary need here, which is to ddl drive the pushdown of a virtual function which can then give you the native_query handling.  The other option is to have source functions declare what virtual function they represent, which could require validation.  For example:

create virtual function func ...;

create foreign function source_func ... OPTIONS ("teiid_rel:virtual_function" 'schema.func' "teiid_rel:native_query" '...');

That would then declare the source support and provide the source handling of the function.  This would just require some additional logic around pushdown.


> There should be a way to push down a virtual function defined in ddl
> --------------------------------------------------------------------
>
>                 Key: TEIID-5977
>                 URL: https://issues.redhat.com/browse/TEIID-5977
>             Project: Teiid
>          Issue Type: Bug
>          Components: Query Engine
>            Reporter: Steven Hawkins
>            Assignee: Steven Hawkins
>            Priority: Major
>             Fix For: 15.0
>
>
> If you create a function that is defined in ddl, it currently requires that a translator be extended to add a pushdown function and handling.  It would be better if there were a way to do this entirely in ddl.  This could be either/or:
> 1. when the function is defined by an expression rather than a more complex procedure statement, we should check to see if that can be inlined.
> 2. provide a way to match source functions.



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the teiid-issues mailing list