dkharrat / NexusData

Core Data for Android
Apache License 2.0
72 stars 19 forks source link

What is wrong with predicate? #17

Open j4nos opened 7 years ago

j4nos commented 7 years ago

demand != null && demand.satisfied == false && gender == "male"

I have the following predicate, and app crashes. Why?

I guess constants are OK, based on this: lexerGrammar.add("(\"[^\"\\\\\\r\\n]*(?:\\\\.[^\"\\\\\\r\\n]*)*\")|\\d+|true|false|null", TokenType.CONSTANT);

comparators too:

 lexerGrammar.add("\\(",     TokenType.OPEN_PAREN);
        lexerGrammar.add("\\)",     TokenType.CLOSE_PAREN);
        lexerGrammar.add("&&",      TokenType.AND);
        lexerGrammar.add("\\|\\|",  TokenType.OR);
        lexerGrammar.add("==",      TokenType.EQUAL);
        lexerGrammar.add("!=",      TokenType.NOT_EQUAL);
        lexerGrammar.add(">=",      TokenType.GREATER_THAN_OR_EQUAL);
        lexerGrammar.add("<=",      TokenType.LESS_THAN_OR_EQUAL);
        lexerGrammar.add(">",       TokenType.GREATER_THAN);
        lexerGrammar.add("<",       TokenType.LESS_THAN);
        lexerGrammar.add("(\"[^\"\\\\\\r\\n]*(?:\\\\.[^\"\\\\\\r\\n]*)*\")|\\d+|true|false|null",       TokenType.CONSTANT);
        lexerGrammar.add("[a-zA-Z][a-zA-Z0-9_]*",   TokenType.FIELD_NAME);
dkharrat commented 7 years ago

What's the exception stack trace you're seeing?

On Tue, Feb 7, 2017 at 6:16 AM, János notifications@github.com wrote:

demand != null AND demand.satisfied == false AND gender == "male"

I have the following predicate, and app crashes. Why?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dkharrat/NexusData/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaKyD6n73QXaUuCECO8j4zWsaHxBANDks5raHymgaJpZM4L5ink .

j4nos commented 7 years ago

In Tokenize class I could debug the predicate. The problem is, that JOIN not allowed, and here in my case in demand.satisfied demand is a relationship name, satisfied is an attribute.