4 Replies Latest reply on Jun 27, 2017 2:00 AM by tomesc

    Empty WHERE clause for unsupported translator capability

    tomesc

      I am writting my own adapter and translater. It works very well so far.

      However I have a question to not supported translator capabilities: It seems that the query (QueryExpression) has no WHERE clause if the statement contains an unsupported capability, and no rows will be shown although my translator delivers all records in this case.

      On the other hand if I send a statement without a WHERE clause all records will be shown as expected.

      Is there a method in the translator to distinguish this two cases from each other or rather is it possible to recognize if a statement contains unsupported content?

      Thank's in advance.

      By the way: I would like to share my adapter/translater with the community. What is the recommended way?

      Regard's

      Thomas

        • 1. Re: Empty WHERE clause for unsupported translator capability
          rareddy

          Thomas,

           

          ExecutionFactory has many different methods that start with "supports" prefix, these are all capabilities that you need to set based on your translator. A list is defined here [1]. Look for methods like "supportsCompareCriteriaEquals" and "supportsComapreCriteriaOrdered" + many more methods. On QueryExpression, is typically a "Select" expression, you need to typecast to that then ask for the "where" on it.

           

          As per contributing back to the community, we would very much appreciate it. Let's start with adding JIRA first, then you can assign to yourself. Then follow the environment setup [2], then when done developing the translator send pull request on github for your changes.

           

           

          [1] Translator Capabilities · Teiid Documentation

          [2] Teiid Eclipse Dev Environment Set Up and Building Runtime Artifacts

          • 2. Re: Empty WHERE clause for unsupported translator capability
            tomesc

            Very thanks for your answer.

            Maybe I was not clear enough. I know the "support" methods and how to get the "where" clause.

            I use TEIID version 8. If I do not overwrite the "supportsComapreCriteriaOrdered" method, the sign ">" will not be supported. But If I send a statement like "select A from T where A > 'X' " anyway, the QueryExpression contains no WHERE clause ("select A from T" only) and my translator assume that no WHERE clause was specified, and tries to deliver all records.

            If I overwrite "supportsComapreCriteriaOrdered" (to deliver TRUE), the QueryExpression contains the WHERE clause as expected.

            I would like to distinguish whether the WHERE clause were suppressed by TEIID or it was not specified.

            Regards,

            Thomas

            • 3. Re: Empty WHERE clause for unsupported translator capability
              rareddy

              It is not really suppressed, but in the case when you did not define the "supportsCompareCriteriaOrdered", the Teiid engine modifies the query to which that of supported by the translator and then applies that criteria on results in its engine. Thus in case some translators like "file" sources do not support WHERE Teiid provides that functionality. So, each "supports" describes a different capability.

              • 4. Re: Empty WHERE clause for unsupported translator capability
                tomesc

                Thanks a lot. Now I am understanding this behaviour.