3 Replies Latest reply on Aug 15, 2014 10:36 AM by Michael Davies

    Passing down partial predicates to translator

    Michael Davies Newbie

      Hi,

       

       

      I am implementing a translator that I will be using within an embedded teiid instance.

       

      Considering the method in ExecutionFactory

      public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, TradeRecConnection connection) throws TranslatorException;

       

       

      What would be really good for me is for teiid to do pretty much all the SQL handling so that I just provide the raw data. This is easy to achieve by using the supports methods.

      But I can handle and optimise predicates on a few of the columns, so it would be good if I could specify these columns and have the predicates that can be applied to them passed down.

      Alternatively if I could get a handle on the original query, ideally in a parse tree, I could do this myself. Is there any way to do this?

       

      Just so I am clear.

       

      Given a query:

      SELECT a,b,c FROM table WHERE a = 'x' AND b = 'y'

      and assuming I can handle predicates involving column a.

       

      Then in the case above I'd like to be passed

      SELECT a,b,c FROM table WHERE a = 'x'

       

      And for teiid to apply the predicate on column b.

       

      Alteratively teiid could pass

       

      SELECT a,b,c FROM table

       

      but I would be able to get hold of the original query and apply the predicates on the column myself so that all rows returned only contained

      column a values of 'x'. Teiid would apply the predicates itself, reapplying the predicate to a.

       

      I am using 8.7. It may be that you can do this - but looking at the API I cannot see how at the moment.

       

      Any help appreciated.

       

      Mick