Why Does Cassandra JSON INSERT Produce “…might involve data filtering…” Error?

123 views
Skip to first unread message

Darwin Airola

unread,
Aug 4, 2016, 10:25:40 PM8/4/16
to DataStax Java Driver for Apache Cassandra User Mailing List

I just reworked the data model (schema) of a table (column family) in order to enable additional queries, and now my inserts (all JSON inserts) produce the dreaded (by me) error:


Error: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING


The main changes that I made to the table (column family) were to create text to text maps of three table fields (replacing sets of UDTs), and I added a TimeUUID and made it the table's primary key.


Also, when I execute the same INSERT via cqlsh, it works fine. Thus, I assume that this is a bug in the Datastax Java Driver.


Is there a workaround to this (apparent) Java driver bug?


Here is my table creation CQL, but I am fairly certain that this is a Java driver bug:


CREATE TABLE IF NOT EXISTS suppliers( id TimeUUID PRIMARY KEY, name text, c set<text>, b text, d text, i map<text, text>, v map<text, text>, a a, p set<frozen<p>>, u map<text, text>, e map<text, text>, h frozen<av>, h set<frozen<h>>, t text );

Before I converted a number of the set<frozen<udt>> to maps, everything worked fine from the Java driver, as well.

Darwin Airola

unread,
Aug 5, 2016, 5:20:25 AM8/5/16
to DataStax Java Driver for Apache Cassandra User Mailing List
I tracked the source of this problem down, and it was not actually the INSERT statement as it seemed to be...

Alexandre Dutra

unread,
Aug 5, 2016, 5:28:00 AM8/5/16
to DataStax Java Driver for Apache Cassandra User Mailing List
Hello Darwin,

Glad to know that you pinned the problem down, as I was a bit surprised by your initial description. FYI the error message about performance unpredictability and ALLOW FILTERING can only happen for SELECT statements, not INSERT (JSON) ones.

What's more, it generally involves a query where you are trying to restrict a clustering column without restricting the partition key, but your table does not even have clustering columns at all, so it seems really impossible here to get such an error.

May I suggest that you read this excellent post about the WHERE clause [1] and this other one about the ALLOW FILTERING clause [2]. If you are still unable to solve your problem, I would suggest that you share with us not only the table structure, but also the SELECT queries you are trying to execute, and the exact driver version.


Thanks,

Alexandre

PS. Your CREATE TABLE statement also has some syntax errors, e.g. the identifier "h" is declared twice.


--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.
--
Alexandre Dutra
Driver & Tools Engineer @ DataStax

Darwin Airola

unread,
Aug 5, 2016, 5:47:34 AM8/5/16
to java-dri...@lists.datastax.com
Alexandre,

The source of the problem was a select to read back the value that I had just inserted, but my development environment was flagging the line before it (the one that executed the INSERT statement) as the problem line. Since the insert worked via the cqlsh, I assumed that there was a driver problem. Ugh.

FYI, the SELECT that produced the problem was a select that only restricted the name column (without restricting the partition key).

Have a great weekend.

Take care,
Darwin


To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-user+unsubscribe@lists.datastax.com.
--
Alexandre Dutra
Driver & Tools Engineer @ DataStax

--
You received this message because you are subscribed to a topic in the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/a/lists.datastax.com/d/topic/java-driver-user/FISMq5NBbEc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to java-driver-user+unsubscribe@lists.datastax.com.



--
P.S. For answers from יהוה, read: Answers From God.
Reply all
Reply to author
Forward
0 new messages