1 Reply Latest reply on Jun 4, 2013 2:17 PM by Steven Hawkins

    User Defined Functions:  PUSHDOWN_ALLOWED vs MUST_PUSHDOWN

    Mark Addleman Master

      From https://issues.jboss.org/browse/TEIID-2518?focusedCommentId=12779279&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12779279

       

       

      By including the function in the physical schema we are currently assuming that it must be a pushdown function - we effectively only check for cannot pushdown and treat allowed/must pushdown the same.  Otherwise you would have to go through the extra step of adding the function to the supported functions list, which seems unnecessary since you've already added the function via a physical schema.

      Ideally global/pushdown allowed functions would be added via a virtual model. 

       

       

      We could declare our function in a virtual model instead but that will have to wait a while as we currently build our VDB completely programmatically and don't have an easy way to declare virtual models.  For now, we can just declare the function to be CANNOT_PUSHDOWN.

       

      That said with the change to allow physical schema to have any virtual construct these assumptions may not quite match your expectations.

       

      Does this mean that we could call f.setVirtual(true) during getMetadata() and achieve the desired PUSHDOWN_ALLOWED behavior?  If so, should the FunctionMethod object default virtual to true when pushdown is set to PUSHDOWN_ALLOWED?  Is PUSHDOWN_ALLOWED & virtual=false a meaningful state?

        • 1. Re: User Defined Functions:  PUSHDOWN_ALLOWED vs MUST_PUSHDOWN
          Steven Hawkins Master

          > We could declare our function in a virtual model instead but that will have to wait a while as we currently build our VDB completely programmatically and don't have an easy way to declare virtual models.

           

          That can be done via ddl in the vdb.xml or a custom metadatarepository, but I can see how that would be less convienent.

           

          > For now, we can just declare the function to be CANNOT_PUSHDOWN.

           

          That was part of the logic behind the simplifying assumption.  That is there still is a way for a translator to declare a purely virtual function - see also the MetadataFactory.addFunction(String, Method) that largely automates that process.

           

          > Does this mean that we could call f.setVirtual(true) during getMetadata() and achieve the desired PUSHDOWN_ALLOWED behavior?  If so, should the FunctionMethod object default virtual to true when pushdown is set to PUSHDOWN_ALLOWED?  Is PUSHDOWN_ALLOWED & virtual=false a meaningful state?

           

          The virtual or (external vs. non-external concept) isn't a simple boolean for functions.  It's something that is inferred from the three pushdown types of allow, not allowed, and must - and whether or not the function has a java class/method set.  Thus it's something that need a little more rationalization.