4 Replies Latest reply on Mar 28, 2014 7:24 PM by shawkins

    Filter on Cassandra

    ichanjasper

      I got exception when running the follow SQL on Cassandra :

       

      y:SELECT Cassandra.sales.store_country, Cassandra.sales.store_city FROM Cassandra.sales

      WHERE (Cassandra.sales.store_city = 'Los Angeles') AND (Cassandra.sales.store_country = 'USA') LIMIT 1000

       

      Caused by: org.teiid.jdbc.TeiidSQLException: TEIID30504 -401769519: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute ths query despite the performance unpredictability, use ALLOW FILTERING

       

      How do I turn ALLOW FILTERING?

       

      Thanks,

       

      - Ivan

        • 1. Re: Filter on Cassandra
          van.halbert

          Here's an example CQL in the upcoming Teiid 8.7 documentation:

           

          SELECT X.*

            FROM cassandra_source.native('SELECT firstname, lastname FROM users WHERE birth_year = $1 AND country = $2 ALLOW FILTERING', 1981, 'US') n,

                 ARRAYTABLE(n.tuple COLUMNS firstname string, lastname string) AS X

          • 2. Re: Filter on Cassandra
            ichanjasper

            Can I use regular SQL syntax?  Can Teiid transforms regular SQL to CQL and append ALLOW FILTERING?

            • 3. Re: Filter on Cassandra
              van.halbert

              According to the doc, its done with a direct query.   So not sure about using SQL, there's no indication (maybe needing more clarification in the documentation).   Here's the draft of 8.7:  Cassandra Translator - Teiid 8.7 (draft) - Project Documentation Editor

              • 4. Re: Filter on Cassandra
                shawkins

                > Can Teiid transforms regular SQL to CQL and append ALLOW FILTERING?

                 

                I'm not sure if it was intentional on the part of the author or the translator or not, but it does not currently have any logic related to ALLOW FILTERING.  If it's generally required, then we'll need to add something.  But if it's something that can be configured on the driver or server side that will mitigate the need for additional translator logic.