10 Replies Latest reply on Dec 4, 2014 8:25 AM by michal.warecki

    Function not being pushed down

    michal.warecki

      Hi guys,

       

      I have an issue with queries which doesn't support "group by" in ExecutionFactory but should support custom function which is inside aggregate function.

      Example:

       

      Input query with not supported group by:

      SELECT AAA, SUM(custom_function(BBB)) AS BBB_ALIAS FROM some_table WHERE some_table.CCC = 'VAL' GROUP BY AAA ORDER BY AAA

       

      Output query (processed by teiid):

      SELECT AAA, BBB AS BBB_ALIAS FROM some_table.CCC = 'VAL'

       

      What I think it should looks like:

      SELECT AAA, custom_function(BBB) AS BBB_ALIAS FROM some_table.CCC = 'VAL'

       

      Why custom_function(BBB) is not being pushed down? In my case this results in exception:

      org.teiid.api.exception.query.FunctionExecutionException: TEIID30341 Function NAMESPACE.custom_function is marked in the function metadata as a function that must be evaluated at the source.

       

      I see that even with built it functions like LOG(), that function is also not pushed down but the results are correct.

       

      With supported "group by", the query is not being translated so I'm able to process it correctly but for one Executor Factory I can't support grouping.

       

      Thanks