Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break is missing in switch (f.getPrimitiveType()) { case CHAR: } at QueryOptimizer.determineIndexToUseSub() #99

Closed
slavap opened this issue May 23, 2017 · 3 comments

Comments

@slavap
Copy link

slavap commented May 23, 2017

Stack trace:
Exception in thread "main" java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number
at org.zoodb.internal.query.QueryOptimizer.determineIndexToUseSub(QueryOptimizer.java:279)
at org.zoodb.internal.query.QueryOptimizer.determineIndexToUse(QueryOptimizer.java:114)
at org.zoodb.jdo.impl.QueryImpl.runQuery(QueryImpl.java:580)
at org.zoodb.jdo.impl.QueryImpl.executeWithArray(QueryImpl.java:728)
at org.zoodb.jdo.impl.QueryImpl.execute(QueryImpl.java:707)
at com.sip.App.main(App.java:49)

Test case is attached, just rename png to zip.
zoodbbugs1

@slavap
Copy link
Author

slavap commented May 23, 2017

By the way, specifying char value right in the filter condition is not working as well:
q.setFilter("ch == 'a' || ch == 'z'");

Error is: Exception in thread "main" javax.jdo.JDOUserException: Query parsing error at 'a' near position 7: Incompatible types,
found 'String', expected: char. Query= ch == 'a' || ch == 'z'

@tzaeschke
Copy link
Owner

Nice catch, that certainly qualifies for the bounty.

Btw, you can use the following construct to reset databases:

        if (ZooHelper.dbExists(dbName)) {
            ZooHelper.removeDb(dbName);
        }

@tzaeschke
Copy link
Owner

I moved the second bug to a separate issue #104.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants