Skip to content

Commit

Permalink
hash calc optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Jan 29, 2024
1 parent a879b4e commit b4d1e9a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export abstract class AbstractForecastingDiviner<
const stopTimestamp = query.timestamp || Date.now()
const startTimestamp = windowSettings.windowSize ? stopTimestamp - windowSettings.windowSize : 0
const data = await this.getPayloadsInWindow(startTimestamp, stopTimestamp)
const sources = (await PayloadBuilder.dataHashes(data)) ?? []
const sources = await PayloadBuilder.dataHashes(data)
const values = await this.forecastingMethod(data, this.transformer)
const response: ForecastPayload = { schema: ForecastPayloadSchema, sources, values }
return [response]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class TemporalIndexingDivinerIndexCandidateToIndexDiviner<
return transformers ? transformers.map((transform) => transform(payload)) : []
})
// Include all the sources for reference
const sources = Object.keys(await PayloadBuilder.toDataHashMap([bw, ...sourcePayloads]))
const sources = await PayloadBuilder.dataHashes([bw, ...sourcePayloads])
// Build and return the index
return await new PayloadBuilder<TemporalIndexingDivinerResultIndex>({ schema: TemporalIndexingDivinerResultIndexSchema })
.fields(Object.assign({ sources }, ...indexFields))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class JsonPathDiviner<
// Use the payload transformers to convert the fields from the source payloads to the destination fields
const fields: PayloadFields[] = this.transforms.map((transform) => transform(payload))
// Include all the sources for reference
const sources = Object.keys(await PayloadBuilder.toDataHashMap([payload]))
const sources = await PayloadBuilder.dataHashes([payload])
// Build and return the index
return await new PayloadBuilder<TOut>({ schema: this.destinationSchema }).fields(Object.assign({ sources }, ...fields)).build()
}),
Expand Down

0 comments on commit b4d1e9a

Please sign in to comment.