Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Nov 20, 2023
1 parent 660d156 commit f744dd0
Showing 1 changed file with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ public Object apply(ResultRow resultRow)

if (resultRowHasTimestamp) {
retVal.add(resultRow.getLong(inPos++));
} else {
retVal.add(query.getUniversalTimestamp().getMillis());
}

for (int i = 0; i < dims.size(); i++) {
Expand Down Expand Up @@ -612,32 +610,37 @@ public Function<Object, ResultRow> pullFromCache(boolean isResultLevelCache)
@Override
public ResultRow apply(Object input)
{
Iterator<Object> results = ((List<Object>) input).iterator();
List<Object> inputList = (List<Object>) input;
Iterator<Object> results = inputList.iterator();

DateTime timestamp = granularity.toDateTime(((Number) results.next()).longValue());

final int size = isResultLevelCache
? query.getResultRowSizeWithPostAggregators()
: query.getResultRowSizeWithoutPostAggregators();

if (size != inputList.size()) {
throw new ISE(
"Stored field count[%d] / output field field count[%d] mismatch",
inputList.size(),
size
);
}

final ResultRow resultRow = ResultRow.create(size);

if (resultRowHasTimestamp) {
DateTime timestamp = granularity.toDateTime(((Number) results.next()).longValue());
resultRow.set(0, timestamp.getMillis());
}

final Iterator<DimensionSpec> dimsIter = dims.iterator();
int dimPos = 0;
while (dimsIter.hasNext() && results.hasNext()) {
final DimensionSpec dimensionSpec = dimsIter.next();
for (int dimPos = 0; dimPos < dims.size(); dimPos++) {
final DimensionSpec dimensionSpec = dims.get(dimPos);

// Must convert generic Jackson-deserialized type into the proper type.
resultRow.set(
dimensionStart + dimPos,
DimensionHandlerUtils.convertObjectToType(results.next(), dimensionSpec.getOutputType())
);

dimPos++;
}

CacheStrategy.fetchAggregatorsFromCache(
Expand All @@ -654,13 +657,6 @@ public ResultRow apply(Object input)
resultRow.set(postAggregatorStart + postPos, results.next());
}
}
if (dimsIter.hasNext() || results.hasNext()) {
throw new ISE(
"Found left over objects while reading from cache!! dimsIter[%s] results[%s]",
dimsIter.hasNext(),
results.hasNext()
);
}

return resultRow;
}
Expand Down

0 comments on commit f744dd0

Please sign in to comment.