Skip to content

Commit

Permalink
fix NPE for transform aggregations (opensearch-project#830)
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Jun 29, 2023
1 parent 87fe870 commit d47d58d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ data class Transform(
groups.add(Dimension.parse(xcp))
}
}
AGGREGATIONS_FIELD -> aggregations = AggregatorFactories.parseAggregators(xcp)
AGGREGATIONS_FIELD -> {
AggregatorFactories.parseAggregators(xcp)?.let { aggregations = it }
}
CONTINUOUS_FIELD -> continuous = xcp.booleanValue()
USER_FIELD -> {
user = if (xcp.currentToken() == Token.VALUE_NULL) null else User.parse(xcp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class TransformRunnerIT : TransformRestTestCase() {
assertTrue("Target transform index was not created", indexExists(transform.targetIndex))
}

waitFor(Instant.ofEpochSecond(60)) {
waitFor(Instant.ofEpochSecond(180)) {
val transformJob = getTransform(transformId = transform.id)
assertNotNull("Transform job doesn't have metadata set", transformJob.metadataId)
val transformMetadata = getTransformMetadata(transformJob.metadataId!!)
Expand Down Expand Up @@ -504,7 +504,7 @@ class TransformRunnerIT : TransformRestTestCase() {
assertTrue("Target transform index was not created", indexExists(transform.targetIndex))
}

waitFor(Instant.ofEpochSecond(60)) {
waitFor(Instant.ofEpochSecond(180)) {
val transformJob = getTransform(transformId = transform.id)
assertNotNull("Transform job doesn't have metadata set", transformJob.metadataId)
val transformMetadata = getTransformMetadata(transformJob.metadataId!!)
Expand Down

0 comments on commit d47d58d

Please sign in to comment.