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-199 Refactor implementation of paginated queries #658

Merged
merged 18 commits into from
Nov 21, 2023

Conversation

agrgr
Copy link

@agrgr agrgr commented Nov 16, 2023

No description provided.

@agrgr agrgr marked this pull request as ready for review November 16, 2023 08:57
@@ -1177,6 +1177,12 @@ private <T> Flux<T> findUsingQueryWithPostProcessing(String setName, Class<T> ta
return results;
}

public <T> Flux<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query) {
Copy link
Member

Choose a reason for hiding this comment

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

Add @Override

@@ -868,6 +868,8 @@ <T, S> Flux<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Clas
*/
<T, S> Flux<S> findInRange(long offset, long limit, Sort sort, Class<T> entityClass, Class<S> targetClass);

<T> Flux<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query);
Copy link
Member

Choose a reason for hiding this comment

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

Javadoc is required

@@ -896,6 +896,8 @@ <T, S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Clas
*/
<T> Stream<T> findInRange(long offset, long limit, Sort sort, Class<T> targetClass, String setName);

<T> Stream<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query);
Copy link
Member

Choose a reason for hiding this comment

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

Javadoc is required

@@ -944,6 +944,12 @@ private <T> Stream<T> findUsingQueryWithPostProcessing(String setName, Class<T>
return applyPostProcessingOnResults(results, query);
}

public <T> Stream<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query) {
Copy link
Member

Choose a reason for hiding this comment

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

Add @Override

@@ -54,6 +54,7 @@ public class QueryEngine {
* scans, set this property to true.
*/
private boolean scansEnabled = false;
private int queryMaxRecords = 100000;
Copy link
Member

Choose a reason for hiding this comment

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

Should be taken from AerospikeDataSettings?

@@ -128,6 +130,11 @@ public void setScansEnabled(boolean scansEnabled) {
this.scansEnabled = scansEnabled;
Copy link
Member

Choose a reason for hiding this comment

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

@Setter?

@@ -128,6 +130,11 @@ public void setScansEnabled(boolean scansEnabled) {
this.scansEnabled = scansEnabled;
}

public void setQueryMaxRecords(int queryMaxRecords) {
Copy link
Member

Choose a reason for hiding this comment

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

@Setter?

@@ -115,4 +117,8 @@ private Mono<KeyRecord> getRecord(Policy policy, Key key, String[] binNames) {
public void setScansEnabled(boolean scansEnabled) {
this.scansEnabled = scansEnabled;
}

public void setQueryMaxRecords(int queryMaxRecords) {
Copy link
Member

Choose a reason for hiding this comment

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

@Setter?

@@ -115,4 +117,8 @@ private Mono<KeyRecord> getRecord(Policy policy, Key key, String[] binNames) {
public void setScansEnabled(boolean scansEnabled) {
this.scansEnabled = scansEnabled;
Copy link
Member

Choose a reason for hiding this comment

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

@Setter?

@agrgr agrgr closed this Nov 16, 2023
@agrgr agrgr reopened this Nov 16, 2023
* @return A Stream of all matching documents regardless of pagination/sorting, returned documents will be mapped to
* targetClass's type.
*/
<T> Stream<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query);
Copy link
Member

@roimenashe roimenashe Nov 16, 2023

Choose a reason for hiding this comment

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

Why does entityClass is wrapped with Class<?>, usually when we have entity and target we use Class<T> for entityClass and Class<S> for targetClass, please align with rest of the methods

* @return A Flux of all matching documents regardless of pagination/sorting, returned documents will be mapped to
* targetClass's type.
*/
<T> Flux<T> findUsingQueryWithoutPostProcessing(Class<?> entityClass, Class<T> targetClass, Query query);
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 Class<?>.

@@ -40,15 +39,15 @@
*/
public class AerospikePartTreeQuery extends BaseAerospikePartTreeQuery {

private final AerospikeOperations operations;
private final AerospikeTemplate template;
Copy link
Member

Choose a reason for hiding this comment

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

Why template instead of operations?

@@ -35,14 +38,14 @@
*/
public class ReactiveAerospikePartTreeQuery extends BaseAerospikePartTreeQuery {

private final ReactiveAerospikeOperations operations;
private final ReactiveAerospikeTemplate template;
Copy link
Member

Choose a reason for hiding this comment

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

Same (why template?)

@@ -1322,8 +1322,8 @@ public void findPersonsByQuery() {
.setFilterOperation(FilterOperation.EQ)
.setValue1(Value.get(49))
.build();
result = repository.findUsingQuery(new Query(ageEq49));
assertThat(result).containsOnly(carter);
// result = repository.findUsingQuery(new Query(ageEq49));
Copy link
Member

Choose a reason for hiding this comment

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

Why commenting assertions? if its not relevant anymore remove

if (qualifier != null) {
Qualifier idQualifier = getOneIdQualifier(qualifier);
if (idQualifier != null) {
// a special flow if there is id given
Copy link
Member

Choose a reason for hiding this comment

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

Sounds grammatically wrong, maybe:
// Dedicate flow when id is given

Copy link
Author

Choose a reason for hiding this comment

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

Agree, updated to a similar phrase

if (qualifier != null) {
Qualifier idQualifier = getOneIdQualifier(qualifier);
if (idQualifier != null) {
// a special flow if there is id given
Copy link
Member

Choose a reason for hiding this comment

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

Same

@agrgr agrgr merged commit 0f8c0ae into main Nov 21, 2023
5 checks passed
@agrgr agrgr deleted the FMWK-199-refactor-paginated-queries branch November 21, 2023 11:35
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