lagom / online-auction-java

Other
129 stars 109 forks source link

InvalidQueryException: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. #163

Closed AmrBouaziz closed 6 years ago

AmrBouaziz commented 6 years ago

https://github.com/lagom/online-auction-java/blob/505b60bb817cec93a6e22813619447631aeeedc7/user-impl/src/main/java/com/example/auction/user/impl/UserRepository.java#L88

In the UserRepository I can read this select statement : SELECT * FROM UserInfo WHERE email = ? however in the create statement the email is not a part of the primary key

"CREATE TABLE IF NOT EXISTS UserInfo (" +
    "userId UUID, " +
    "name text, " +
    "email text, " +
    "PRIMARY KEY (userId) " +
    ")"

When I tried to execute a similar feature in my on going project I got the following error :

{
  "name": "com.datastax.driver.core.exceptions.InvalidQueryException: 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",
    "detail": "com.datastax.driver.core.exceptions.InvalidQueryException: 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\n\tat com.datastax.driver.core.Responses$Error.asException(Responses.java:136)\n\tat com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:220)\n\tat com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:196)\n\tat com.google.common.util.concurrent.Futures$AsyncChainingFuture.doTransform(Futures.java:1442)\n\tat com.google.common.util.concurrent.Futures$AsyncChainingFuture.doTransform(Futures.java:1433)\n\tat com.google.common.util.concurrent.Futures$AbstractChainingFuture.run(Futures.java:1408)\n\tat com.google.common.util.concurrent.Futures$2$1.run(Futures.java:1177)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)\n\tat java.lang.Thread.run(Thread.java:748)\n"
}

Is it possible to achieve this without the use of a MATERIALIZED VIEW or the ALLOW FILTERING ?

ignasi35 commented 6 years ago

This has been reworked and that query no longer exists. The discussion, though, still may be of interest. I recommend opening a topic on https://discuss.lightbend.com/