Skip to content

CLIENT-4614 index on sets - #31

Merged
BrianNichols merged 8 commits into
initfrom
CLIENT-4614-index-on-sets
Apr 22, 2026
Merged

CLIENT-4614 index on sets#31
BrianNichols merged 8 commits into
initfrom
CLIENT-4614-index-on-sets

Conversation

@gagan405

Copy link
Copy Markdown
Contributor

Applies the same changes as aerospike/aerospike-expression-lang-java#72

@BrianNichols BrianNichols left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes looks reasonable to me. Since it involves AEL code, I will defer to Tim's review.

Comment on lines +106 to +108
String querySet = Optional.ofNullable(indexContext)
.map(IndexContext::getQuerySet)
.orElse(null);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an anti-pattern and a poor use of Optional. Any time you do .orElse(null) it's a strong signal that Optional is being force into a role it's not designed for.

Why not just use

String querySet = indexContext == null ? null : indexContext.getQuerySet();

? It saves a couple of memory allocations and is clearer code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on both places. Its just copy paste from existing code. I will clean it up.

.orElse(null);
Map<String, List<Index>> indexesMap = buildIndexesMap(
Optional.ofNullable(indexContext).map(IndexContext::getIndexes).orElse(null), namespace);
Optional.ofNullable(indexContext).map(IndexContext::getIndexes).orElse(null),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above. (I know it's existing code, but let's fix it up. The next line too.)

Comment on lines +193 to 194
public ParseResult process(String namespace, String querySet, Session session) {
return new ParseResult(null, exp);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put a comment in saying the querySet has been deliberately ignored to show that it has been considered (low importance)


@Override
public ParseResult process(String namespace, Session session) {
public ParseResult process(String namespace, String querySet, Session session) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put a comment in saying the querySet has been deliberately ignored to show that it has been considered (low importance)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added comments. I think the class structure can be improved by some refactors, so we wouldnt have to use methods that pass unused params. Will do that separately from this change.

@BrianNichols
BrianNichols merged commit 0338988 into init Apr 22, 2026
4 checks passed
@BrianNichols
BrianNichols deleted the CLIENT-4614-index-on-sets branch April 24, 2026 18:34
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

Successfully merging this pull request may close these issues.

3 participants