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

FMWK-427 Qualifier builder API redesign #744

Merged
merged 11 commits into from
May 26, 2024

Conversation

agrgr
Copy link

@agrgr agrgr commented May 22, 2024

  • QualifierBuilder: replace binName, binType, ctx, key with path
  • Add @Beta annotation to QualifierBuilder
  • Refactoring

@agrgr agrgr requested review from roimenashe and reugn May 22, 2024 19:01
@agrgr agrgr marked this pull request as ready for review May 26, 2024 07:34
.setFilterOperation(FilterOperation.MAP_VAL_EQ_BY_KEY)
.setKey(getKey(qualifierMap))
.setPath(path)
Copy link
Member

Choose a reason for hiding this comment

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

2 setPath's in a single QualifierBuilder?

Copy link
Author

Choose a reason for hiding this comment

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

It was left after uncommenting, thanks.

@@ -1277,7 +1281,8 @@ private static Exp processMetadataFieldInOrNot(Map<QualifierKey, Object> qualifi
Exp[] listElementsExp = listOfLongs.stream().map(item ->
Qualifier.metadataBuilder()
.setMetadataField(getMetadataField(qualifierMap))
.setFilterOperation(filterOperation)
// .setFilterOperation(filterOperation)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this comment? if not let's remove

@roimenashe
Copy link
Member

roimenashe commented May 26, 2024

@agrgr So path replaces binName with optional context and nestedKey, but it uses the sindex unique DSL which we use only in Spring Data Aerospike, I'm not sure about that.

  1. For me binName with context and nested key is more intuitive than a path with a DSL but that's personal, in most cases queries won't include CTX/nesting so path is less self explanatory than binName.
  2. A new DSL which will be used in the new Client API design is in the works, check for DSLPath here, it makes more sense for me to align with the new Client API DSL instead of with our sindex unique DSL which will probably be replaced with a new DSL.

Btw, keeping both is also an option which we can consider, that's what the new Client API does, for example change .setPath() to something like .setDSLPath() and keep binName, CTX etc... as they are).

I might be wrong, we can get into more details privately, lets talk about it.

@agrgr
Copy link
Author

agrgr commented May 26, 2024

we can get into more details privately, lets talk about it.

@roimenashe Yes, let's discuss. Don't see any issue with having path in most cases containing only binName, this is exactly the idea - to have one field that describes whole path to the needed element, and not to require from a user to figure out what is the last element separately, or what is the correct CTX between binName and the last element (exlusive), etc. Besides, we are adding CTX support in the upcoming release, and integrating it into the path seemes like an option not to introduce new setters.

Moreover, the changes allowed to clean up QualifierBuilder API, so instead of many setters there are fewer which simplifies the usage and removes all internal setters.
Speaking about new DSL - again, let's talk, I think we might add support for newer DSL in future, however, we already are using singular path elements DSL in the @Indexed annotations, so it is more like a reuse of the existing API.

Exp[] arrElementsExp = collection.stream().map(item ->
Qualifier.builder()
.setBinName(getBinName(qualifierMap))
.setPath(getBinName(qualifierMap))
Copy link
Member

Choose a reason for hiding this comment

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

same here

@agrgr agrgr merged commit dae6842 into main May 26, 2024
7 checks passed
@agrgr agrgr deleted the FMWK-427-qualifierBuilder-API-redesign branch May 26, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants