Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into DVX-522
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgrote committed Jun 24, 2024
2 parents 3c267b3 + 7c0301d commit d58c412
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ jobs:
GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
- name: Stage release
run: |
./gradlew buildZip publishToSonatype closeAndReleaseSonatypeStagingRepository -Dorg.gradle.project.sonatypeUsername=$NEXUS_USERNAME -Dorg.gradle.project.sonatypePassword=$NEXUS_PASSWORD -Dorg.gradle.project.signing.gnupg.keyName=$GPG_SIGNING_KEYID -Dorg.gradle.project.signing.gnupg.passphrase=$GPG_SIGNING_PASSPHRASE
./gradlew buildZip publishToSonatype closeAndReleaseSonatypeStagingRepository -Dorg.gradle.project.sonatypeUsername=$SONATYPE_USER -Dorg.gradle.project.sonatypePassword=$SONATYPE_TOKEN -Dorg.gradle.project.signing.gnupg.keyName=$GPG_SIGNING_KEYID -Dorg.gradle.project.signing.gnupg.passphrase=$GPG_SIGNING_PASSPHRASE
env:
GH_USERNAME: ${{ github.actor }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
GPG_SIGNING_KEYID: ${{ secrets.GPG_SIGNING_KEYID }}
GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
publish-base-image:
Expand Down
21 changes: 21 additions & 0 deletions sdk/src/main/java/com/atlan/model/search/IndexSearchResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,23 @@ public static boolean presortedByTimestamp(List<SortOptions> sort) {
&& sort.get(0).field().order() == SortOrder.Asc;
}

/**
* Indicates whether the sort options contain any user-requested sorting (true) or not (false).
*
* @param sort list of sorting options
* @return true if the sorting options have any user-requested sorting
*/
public static boolean hasUserRequestedSort(List<SortOptions> sort) {
if (presortedByTimestamp(sort)) {
return false;
}
if (sort != null && !sort.isEmpty() && sort.get(0).isField()) {
String fieldName = sort.get(0).field().field();
return !fieldName.equals(Asset.GUID.getInternalFieldName()) || sort.size() != 1;
}
return true;
}

/**
* Rewrites the sorting options to ensure that sorting by creation time, ascending, is the top
* priority. Adds this condition if it does not already exist, or moves it up to the top sorting
Expand Down Expand Up @@ -534,6 +551,10 @@ public IndexSearchResponseBulkIterator(IndexSearchResponse response) {
if (presortedByTimestamp(dsl.getSort())) {
// If the results are already sorted in ascending order by timestamp, proceed
this.response = response;
} else if (hasUserRequestedSort(dsl.getSort())) {
// Alternatively, if they are sorted by any user-requested sort, we need to throw an error
throw new IllegalArgumentException(
"Bulk searches can only be sorted by timestamp in ascending order - you must remove your own requested sorting to run a bulk search.");
} else {
// Otherwise, re-fetch the first page sorted first by timestamp
this.response = response.getFirstPageTimestampOrdered();
Expand Down

0 comments on commit d58c412

Please sign in to comment.