-
Notifications
You must be signed in to change notification settings - Fork 297
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
CBL-5180: Implement Array Index API #3327
base: release/3.2
Are you sure you want to change the base?
Conversation
expressions: @[@""]]; | ||
} else { | ||
for (NSString* expression in expressions) { | ||
if (!expression) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- NSArray/NSMutableArray doesn't allow nil so there is no need to check this for iOS.
- The only thing that is needed to evaluate is whether expressions is empty or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for reminding me about NSArray/MutableArray, changing now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably fine but I also check that there is at least one non-empty element in the array before sending it to Core.
As you know, [""] works, but I would guess more often than not this is an error in the user's logic that ended up with empty string, rather than the user purposefully sending an empty string in the array (as opposed to nil). If there is at least one non-empty string in the list then any empty strings will then be caught and errored by Core.
@borrrden if is nil, I pass to Core [""] anyway. IMO, if we go ahead and check whether a non-empty list has any empty values, we might as well fail straight away in the case that is nil as well. Which then makes us handle most, if not all, scenarios, instead of letting Core to do it. EDIT: But what does LiteCore do in that scenario? |
I've chat with Jianmin, and confirmed that will throw as invalid n1ql, which can be confusing depending of it actually showing where the problem is, but my understanding is that Core shouldn't even query with the above from Jens, but throw. I will add this additional check if it ends up not being covered by Core. |
LiteCore will index the complex value which will turn out to be unuseful. There will be no error. |
No description provided.